Package org.elasticsearch.repositories
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
Service responsible for maintaining and providing access to snapshot repositories on nodes.
-
Field Summary
FieldsFields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle -
Constructor Summary
ConstructorsConstructorDescriptionRepositoriesService(Settings settings, ClusterService clusterService, TransportService transportService, Map<String,Repository.Factory> typesRegistry, Map<String,Repository.Factory> internalTypesRegistry, ThreadPool threadPool) -
Method Summary
Modifier and TypeMethodDescriptionvoidChecks if new repositories appeared in or disappeared from cluster metadata and updates current list of repositories accordingly.clearRepositoriesStatsArchive(long maxVersionToClear)protected voiddoClose()protected voiddoStart()protected voiddoStop()voidgetRepositoryData(String repositoryName, ActionListener<RepositoryData> listener)Gets theRepositoryDatafor the given repository.static booleanvoidregisterInternalRepository(String name, String type)voidregisterRepository(PutRepositoryRequest request, ActionListener<AcknowledgedResponse> listener)Registers new repository in the clusterrepository(String repositoryName)Returns registered repositoryvoidvoidunregisterRepository(DeleteRepositoryRequest request, ActionListener<AcknowledgedResponse> listener)Unregisters repository in the clusterstatic voidupdateRepositoryUuidInMetadata(ClusterService clusterService, String repositoryName, RepositoryData repositoryData, ActionListener<Void> listener)Set the repository UUID in the named repository'sRepositoryMetadatato match the UUID in itsRepositoryData, which may involve a cluster state update.voidverifyRepository(String repositoryName, ActionListener<List<DiscoveryNode>> listener)Methods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
-
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
-
-
Constructor Details
-
RepositoriesService
public RepositoriesService(Settings settings, ClusterService clusterService, TransportService transportService, Map<String,Repository.Factory> typesRegistry, Map<String,Repository.Factory> internalTypesRegistry, ThreadPool threadPool)
-
-
Method Details
-
registerRepository
public void registerRepository(PutRepositoryRequest request, ActionListener<AcknowledgedResponse> listener)Registers new repository in the clusterThis 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 requestlistener- 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'sRepositoryMetadatato match the UUID in itsRepositoryData, which may involve a cluster state update.- Parameters:
listener- notified when theRepositoryMetadatais 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 clusterThis method can be only called on the master node. It removes repository information from cluster metadata.
- Parameters:
request- unregister repository requestlistener- unregister repository listener
-
verifyRepository
-
isDedicatedVotingOnlyNode
-
applyClusterState
Checks if new repositories appeared in or disappeared from cluster metadata and updates current list of repositories accordingly.- Specified by:
applyClusterStatein interfaceClusterStateApplier- Parameters:
event- cluster changed event
-
getRepositoryData
Gets theRepositoryDatafor the given repository.- Parameters:
repositoryName- repository namelistener- listener to passRepositoryDatato
-
repository
Returns registered repository- Parameters:
repositoryName- repository name- Returns:
- registered repository
- Throws:
RepositoryMissingException- if repository with such name isn't registered
-
getRepositories
- Returns:
- the current collection of registered repositories, keyed by name.
-
repositoriesStats
-
clearRepositoriesStatsArchive
-
registerInternalRepository
-
unregisterInternalRepository
-
doStart
protected void doStart()- Specified by:
doStartin classAbstractLifecycleComponent
-
doStop
protected void doStop()- Specified by:
doStopin classAbstractLifecycleComponent
-
doClose
- Specified by:
doClosein classAbstractLifecycleComponent- Throws:
IOException
-