- All Implemented Interfaces:
Closeable
,AutoCloseable
,ClusterStateApplier
,LifecycleComponent
,Releasable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Task class that extracts the 'execute' part of the functionality for registering repositories.static class
Task class that extracts the 'execute' part of the functionality for unregistering repositories. -
Field Summary
FieldsModifier and TypeFieldDescriptionFields 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, List<BiConsumer<Snapshot, IndexVersion>> preRestoreChecks) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks if new repositories appeared in or disappeared from cluster metadata and updates current list of repositories accordingly.clearRepositoriesStatsArchive
(long maxVersionToClear) createRepository
(RepositoryMetadata repositoryMetadata) Creates a repository holder.protected void
doClose()
Close this component.protected void
doStart()
Start this component.protected void
doStop()
Stop this component.void
getRepositoryData
(String repositoryName, ActionListener<RepositoryData> listener) Gets theRepositoryData
for the given repository.static boolean
void
registerInternalRepository
(String name, String type) void
registerRepository
(PutRepositoryRequest request, ActionListener<AcknowledgedResponse> listener) Registers new repository in the clusterrepository
(String repositoryName) Returns registered repositoryvoid
void
unregisterRepository
(DeleteRepositoryRequest request, ActionListener<AcknowledgedResponse> listener) Unregisters repository in the clusterstatic void
updateRepositoryUuidInMetadata
(ClusterService clusterService, String repositoryName, RepositoryData repositoryData, ActionListener<Void> listener) Set the repository UUID in the named repository'sRepositoryMetadata
to match the UUID in itsRepositoryData
, which may involve a cluster state update.void
Ensures that we can create the repository and that it's creation actually worksstatic void
validateRepositoryName
(String repositoryName) void
verifyRepository
(String repositoryName, ActionListener<List<DiscoveryNode>> listener) Methods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, start, stop
-
Field Details
-
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, List<BiConsumer<Snapshot, IndexVersion>> preRestoreChecks)
-
-
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
-
validateRepositoryCanBeCreated
Ensures that we can create the repository and that it's creation actually worksThis verification method will create and then close the repository we want to create.
- Parameters:
request
-
-
updateRepositoryUuidInMetadata
public static void updateRepositoryUuidInMetadata(ClusterService clusterService, String repositoryName, RepositoryData repositoryData, ActionListener<Void> listener) Set the repository UUID in the named repository'sRepositoryMetadata
to match the UUID in itsRepositoryData
, which may involve a cluster state update.- Parameters:
listener
- notified when theRepositoryMetadata
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 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:
applyClusterState
in interfaceClusterStateApplier
- Parameters:
event
- cluster changed event
-
getRepositoryData
Gets theRepositoryData
for the given repository.- Parameters:
repositoryName
- repository namelistener
- listener to passRepositoryData
to
-
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
-
getRepositoriesThrottlingStats
-
clearRepositoriesStatsArchive
-
registerInternalRepository
-
unregisterInternalRepository
-
createRepository
Creates a repository holder.WARNING: This method is intended for expert only usage mainly in plugins/modules. Please take note of the following:
- This method does not register the repository (e.g., in the cluster state).
- This method starts the repository. The repository should be closed after use.
- The repository metadata should be associated to an already registered non-internal repository type and factory pair.
- Parameters:
repositoryMetadata
- the repository metadata- Returns:
- the started repository
- Throws:
RepositoryException
- if repository type is not registered
-
validateRepositoryName
-
getPreRestoreVersionChecks
-
doStart
protected void doStart()Description copied from class:AbstractLifecycleComponent
Start this component. Typically that means doing things like launching background processes and registering listeners on other components. Other components have been initialized by this point, but may not yet be started.If this method throws an exception then the startup process will fail, but this component will not be stopped before it is closed.
This method is called while synchronized on
AbstractLifecycleComponent.lifecycle
. It is only called once in the lifetime of a component, although it may not be called at all if the startup process encountered some kind of fatal error, such as the failure of some other component to initialize or start.- Specified by:
doStart
in classAbstractLifecycleComponent
-
doStop
protected void doStop()Description copied from class:AbstractLifecycleComponent
Stop this component. Typically that means doing the reverse of whateverAbstractLifecycleComponent.doStart()
does.This method is called while synchronized on
AbstractLifecycleComponent.lifecycle
. It is only called once in the lifetime of a component, after callingAbstractLifecycleComponent.doStart()
, although it will not be called at all if this component did not successfully start.- Specified by:
doStop
in classAbstractLifecycleComponent
-
doClose
Description copied from class:AbstractLifecycleComponent
Close this component. Typically that means doing the reverse of whatever happened during initialization, such as releasing resources acquired there.This method is called while synchronized on
AbstractLifecycleComponent.lifecycle
. It is called once in the lifetime of a component. If the component was started then it will be stopped before it is closed, and once it is closed it will not be started or stopped.- Specified by:
doClose
in classAbstractLifecycleComponent
- Throws:
IOException
-