Interface CachedEnvironmentService

All Known Implementing Classes:
CachedEnvironmentServiceImpl

@ExperimentalApi public interface CachedEnvironmentService
Cache for deployment environments and dashboard. Provides methods to retrieve and manage deployment environments with caching mechanisms.
Since:
11.0
  • Method Details

    • getDashboardPageUnrestricted

      @NotNull @NotNull List<Pair<Long,Long>> getDashboardPageUnrestricted(int offset, int limit, @Nullable @Nullable String filter)
      Retrieves a list of environment IDs and their corresponding deployment project IDs for the dashboard page.
      Parameters:
      offset - the starting point of the list
      limit - the maximum number of items to return
      filter - an optional filter to apply
      Returns:
      a list of pairs containing deployment project ID and environment ID.
    • getEnvironmentsForDeploymentProject

      @NotNull @NotNull List<Environment> getEnvironmentsForDeploymentProject(long deploymentProjectId)
      Retrieves a list of environments for a specific deployment project.
      Parameters:
      deploymentProjectId - the ID of the deployment project
      Returns:
      a list of environments for the specified deployment project
    • streamInternalEnvironmentsByIdsUnrestricted

      @NotNull @NotNull Stream<InternalEnvironment> streamInternalEnvironmentsByIdsUnrestricted(@NotNull @NotNull Set<Long> environmentIds)
      Streams internal environments by their IDs without restrictions.
      Parameters:
      environmentIds - the set of environment IDs
      Returns:
      a stream of internal environments
    • createImmutableEnvironment

      @NotNull @NotNull Environment createImmutableEnvironment(@NotNull @NotNull InternalEnvironment environment)
      Parameters:
      environment -
    • getEnvironmentStubsForDeploymentProject

      @NotNull @NotNull List<EnvironmentStub> getEnvironmentStubsForDeploymentProject(long deploymentProjectId)
      Retrieves a list of environment stubs for a specific deployment project.
      Parameters:
      deploymentProjectId - the ID of the deployment project
      Returns:
      a list of environment stubs for the specified deployment project
    • getDeploymentProjectIdForEnvironment

      @Nullable @Nullable Long getDeploymentProjectIdForEnvironment(long environmentId)
      Retrieves the deployment project ID for a specific environment.
      Parameters:
      environmentId - the ID of the environment
      Returns:
      the deployment project ID, or null if not found
    • initialiseTriggers

      void initialiseTriggers(org.apache.logging.log4j.Logger log, Date lastShutdownTime)
      Initialise triggers on all active environments.
      Parameters:
      log - the logger to use
      lastShutdownTime - the last shutdown time
    • initialiseCache

      void initialiseCache(@NotNull @NotNull Iterable<? extends InternalDeploymentProject> deploymentProjects)
      Initializes the cache with the given deployment projects. Do NOT call this method multiple times; cache can be initialized only once.
      Parameters:
      deploymentProjects - the deployment projects to initialize the cache with
    • removeEnvironment

      void removeEnvironment(long environmentId)
      Removes an environment from the cache by its ID.
      Parameters:
      environmentId - the ID of the environment to remove
    • removeDeploymentProject

      void removeDeploymentProject(long deploymentProjectId)
      Removes a deployment project from the cache by its ID.
      Parameters:
      deploymentProjectId - the ID of the deployment project to remove
    • refreshByRequirementSetId

      void refreshByRequirementSetId(long requirementSetId)
      Refreshes the cache for environments by a specific requirement set ID.
      Parameters:
      requirementSetId - the ID of the requirement set
    • reindexDeploymentProject

      @Internal void reindexDeploymentProject(@NotNull @NotNull InternalDeploymentProject deploymentProject)
      Reindexes a deployment project in the cache.
      Parameters:
      deploymentProject - the deployment project to reindex
    • refreshEnvironment

      void refreshEnvironment(long environmentId)
      Refreshes the cache for a specific environment.
      Parameters:
      environmentId - the ID of the environment to refresh
    • getEnvironment

      @Nullable @Nullable Environment getEnvironment(long environmentId)
      Retrieves an environment by its ID.
      Parameters:
      environmentId - the ID of the environment
      Returns:
      the environment, or null if not found
    • getEnvironmentUnrestricted

      @Nullable @Nullable Environment getEnvironmentUnrestricted(long environmentId)
      Get specific environment by ID. Does not check permissions.
      Parameters:
      environmentId - ID to search for
      Returns:
      environment with given ID or null if one could not be found.
    • getEnvironmentWithConsistencyGuarantee

      @Nullable @Nullable Environment getEnvironmentWithConsistencyGuarantee(long environmentId)
      Retrieves an environment by its ID with consistency guarantee.
      Parameters:
      environmentId - the ID of the environment
      Returns:
      the environment with consistency guarantee, or null if not found
    • getEnvironmentsForDeploymentProjectWithConsistencyGuarantee

      @NotNull @NotNull List<Environment> getEnvironmentsForDeploymentProjectWithConsistencyGuarantee(long deploymentProjectId)
      Retrieves a list of environments for a specific deployment project with consistency guarantee.
      Parameters:
      deploymentProjectId - the ID of the deployment project
      Returns:
      a list of environments for the specified deployment project
    • getEnvironmentRequirementSet

      @Nullable @Nullable ImmutableRequirementSet getEnvironmentRequirementSet(long environmentId)
      Retrieves the requirement set for a specific environment.
      Parameters:
      environmentId - the ID of the environment
      Returns:
      the requirement set, or null if not found
    • getAllEnvironments

      @NotNull @NotNull Iterable<Environment> getAllEnvironments()
      Retrieves all environments.
      Returns:
      an iterable of all environments
    • getAllInternalEnvironmentsNoUserContext

      @NotNull @NotNull Iterable<InternalEnvironment> getAllInternalEnvironmentsNoUserContext()
      Retrieves all environments defined in the system without filling in operations permitted for the user.
      Returns:
      an iterable of all environments
    • getEnvironmentsUsingRepository

      List<Environment> getEnvironmentsUsingRepository(long repositoryId)
      Parameters:
      repositoryId - repository id
      Returns:
      list of immutable Environments that use given repository
    • getCacheStats

      @NotNull @NotNull BambooCacheStats getCacheStats()
      Retrieve cache statistics
      Returns:
      Cache statistics
    • isCacheActive

      boolean isCacheActive()
    • getPaginatedEnvironmentsForDeploymentProject

      @Internal @NotNull @NotNull PaginatedEnvironmentsForDashboard getPaginatedEnvironmentsForDeploymentProject(long deploymentProjectId, int start, int limit, String filter)
      Get paginated environments for a particular deployment project ordered by position. Does not validate deployment project actually exists. Filtering requires at least one character. If filter is null or empty then no filtering.
      Parameters:
      deploymentProjectId - of the deployment project to get environments for
      start - start by index
      limit - return no more entries than limit
      filter - filter
      Returns:
      List of environments for a single deployment project. Sorted by position.
      See Also:
    • moveEnvironment

      @NotNull @NotNull ErrorCollection moveEnvironment(MoveEnvironmentStrategy moveEnvironmentStrategy, long deploymentProjectId, long environmentId, int currentPosition, Optional<Long> relatedEnvId)
      Move Environment in given deploymentProject with given strategy. relatedEnvId is optional for most cases. It is only required for strategy MoveEnvironmentStrategy.AFTER or MoveEnvironmentStrategy.BEFORE This method ensures that all caches are refreshed alongside the permanent change on the persistence layer, allowing the new environment positions to be displayed correctly everywhere immediately.
      Parameters:
      moveEnvironmentStrategy -
      deploymentProjectId -
      environmentId -
      currentPosition -
      relatedEnvId -
      Returns:
      error collection
      Since:
      12.1