Package org.elasticsearch.repositories
Class RepositoriesService
java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.repositories.RepositoriesService
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,ClusterStateApplier
,LifecycleComponent
,Releasable
public class RepositoriesService extends AbstractLifecycleComponent implements ClusterStateApplier
Service responsible for maintaining and providing access to snapshot repositories on nodes.
-
Field Summary
Fields Modifier and Type Field Description static Setting<java.lang.Integer>
REPOSITORIES_STATS_ARCHIVE_MAX_ARCHIVED_STATS
static Setting<org.elasticsearch.common.unit.TimeValue>
REPOSITORIES_STATS_ARCHIVE_RETENTION_PERIOD
-
Constructor Summary
Constructors Constructor Description RepositoriesService(Settings settings, ClusterService clusterService, TransportService transportService, java.util.Map<java.lang.String,Repository.Factory> typesRegistry, java.util.Map<java.lang.String,Repository.Factory> internalTypesRegistry, ThreadPool threadPool)
-
Method Summary
Modifier and Type Method Description void
applyClusterState(ClusterChangedEvent event)
Checks if new repositories appeared in or disappeared from cluster metadata and updates current list of repositories accordingly.java.util.List<RepositoryStatsSnapshot>
clearRepositoriesStatsArchive(long maxVersionToClear)
protected void
doClose()
protected void
doStart()
protected void
doStop()
void
getRepositoryData(java.lang.String repositoryName, ActionListener<RepositoryData> listener)
Gets theRepositoryData
for the given repository.void
registerInternalRepository(java.lang.String name, java.lang.String type)
void
registerRepository(PutRepositoryRequest request, ActionListener<ClusterStateUpdateResponse> listener)
Registers new repository in the clusterjava.util.List<RepositoryStatsSnapshot>
repositoriesStats()
Repository
repository(java.lang.String repositoryName)
Returns registered repositoryvoid
unregisterInternalRepository(java.lang.String name)
void
unregisterRepository(DeleteRepositoryRequest request, ActionListener<ClusterStateUpdateResponse> listener)
Unregisters repository in the clustervoid
verifyRepository(java.lang.String repositoryName, ActionListener<java.util.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.common.unit.TimeValue> REPOSITORIES_STATS_ARCHIVE_RETENTION_PERIOD -
REPOSITORIES_STATS_ARCHIVE_MAX_ARCHIVED_STATS
-
-
Constructor Details
-
RepositoriesService
public RepositoriesService(Settings settings, ClusterService clusterService, TransportService transportService, java.util.Map<java.lang.String,Repository.Factory> typesRegistry, java.util.Map<java.lang.String,Repository.Factory> internalTypesRegistry, ThreadPool threadPool)
-
-
Method Details
-
registerRepository
public void registerRepository(PutRepositoryRequest request, ActionListener<ClusterStateUpdateResponse> 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
-
unregisterRepository
public void unregisterRepository(DeleteRepositoryRequest request, ActionListener<ClusterStateUpdateResponse> 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
public void verifyRepository(java.lang.String repositoryName, ActionListener<java.util.List<DiscoveryNode>> listener) -
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
public void getRepositoryData(java.lang.String repositoryName, ActionListener<RepositoryData> listener)Gets theRepositoryData
for the given repository.- Parameters:
repositoryName
- repository namelistener
- listener to passRepositoryData
to
-
repository
Returns registered repositoryThis method is called only on the master node
- Parameters:
repositoryName
- repository name- Returns:
- registered repository
- Throws:
RepositoryMissingException
- if repository with such name isn't registered
-
repositoriesStats
-
clearRepositoriesStatsArchive
public java.util.List<RepositoryStatsSnapshot> clearRepositoriesStatsArchive(long maxVersionToClear) -
registerInternalRepository
public void registerInternalRepository(java.lang.String name, java.lang.String type) -
unregisterInternalRepository
public void unregisterInternalRepository(java.lang.String name) -
doStart
protected void doStart()- Specified by:
doStart
in classAbstractLifecycleComponent
-
doStop
protected void doStop()- Specified by:
doStop
in classAbstractLifecycleComponent
-
doClose
protected void doClose() throws java.io.IOException- Specified by:
doClose
in classAbstractLifecycleComponent
- Throws:
java.io.IOException
-