Class RepositoriesService

java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.repositories.RepositoriesService
All Implemented Interfaces:
Closeable, AutoCloseable, ClusterStateApplier, LifecycleComponent, org.elasticsearch.core.Releasable

public class RepositoriesService extends AbstractLifecycleComponent implements ClusterStateApplier
Service responsible for maintaining and providing access to snapshot repositories on nodes.
  • Field Details

    • REPOSITORIES_STATS_ARCHIVE_RETENTION_PERIOD

      public static final Setting<org.elasticsearch.core.TimeValue> REPOSITORIES_STATS_ARCHIVE_RETENTION_PERIOD
    • REPOSITORIES_STATS_ARCHIVE_MAX_ARCHIVED_STATS

      public static final Setting<Integer> REPOSITORIES_STATS_ARCHIVE_MAX_ARCHIVED_STATS
  • Constructor Details

  • Method Details

    • registerRepository

      public void registerRepository(PutRepositoryRequest request, ActionListener<AcknowledgedResponse> listener)
      Registers new repository in the cluster

      This method can be only called on the master node. It tries to create a new repository on the master and if it was successful it adds new repository to cluster metadata.

      Parameters:
      request - register repository request
      listener - register repository listener
    • updateRepositoryUuidInMetadata

      public static void updateRepositoryUuidInMetadata(ClusterService clusterService, String repositoryName, RepositoryData repositoryData, ActionListener<Void> listener)
      Set the repository UUID in the named repository's RepositoryMetadata to match the UUID in its RepositoryData, which may involve a cluster state update.
      Parameters:
      listener - notified when the RepositoryMetadata is updated, possibly on this thread or possibly on the master service thread
    • unregisterRepository

      public void unregisterRepository(DeleteRepositoryRequest request, ActionListener<AcknowledgedResponse> listener)
      Unregisters repository in the cluster

      This method can be only called on the master node. It removes repository information from cluster metadata.

      Parameters:
      request - unregister repository request
      listener - unregister repository listener
    • verifyRepository

      public void verifyRepository(String repositoryName, ActionListener<List<DiscoveryNode>> listener)
    • isDedicatedVotingOnlyNode

      public static boolean isDedicatedVotingOnlyNode(Set<DiscoveryNodeRole> roles)
    • applyClusterState

      public void applyClusterState(ClusterChangedEvent event)
      Checks if new repositories appeared in or disappeared from cluster metadata and updates current list of repositories accordingly.
      Specified by:
      applyClusterState in interface ClusterStateApplier
      Parameters:
      event - cluster changed event
    • getRepositoryData

      public void getRepositoryData(String repositoryName, ActionListener<RepositoryData> listener)
      Gets the RepositoryData for the given repository.
      Parameters:
      repositoryName - repository name
      listener - listener to pass RepositoryData to
    • repository

      public Repository repository(String repositoryName)
      Returns registered repository
      Parameters:
      repositoryName - repository name
      Returns:
      registered repository
      Throws:
      RepositoryMissingException - if repository with such name isn't registered
    • getRepositories

      public Map<String,​Repository> getRepositories()
      Returns:
      the current collection of registered repositories, keyed by name.
    • repositoriesStats

      public List<RepositoryStatsSnapshot> repositoriesStats()
    • clearRepositoriesStatsArchive

      public List<RepositoryStatsSnapshot> clearRepositoriesStatsArchive(long maxVersionToClear)
    • registerInternalRepository

      public void registerInternalRepository(String name, String type)
    • unregisterInternalRepository

      public void unregisterInternalRepository(String name)
    • doStart

      protected void doStart()
      Specified by:
      doStart in class AbstractLifecycleComponent
    • doStop

      protected void doStop()
      Specified by:
      doStop in class AbstractLifecycleComponent
    • doClose

      protected void doClose() throws IOException
      Specified by:
      doClose in class AbstractLifecycleComponent
      Throws:
      IOException