Class FilterRepository
- java.lang.Object
-
- org.elasticsearch.repositories.FilterRepository
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,LifecycleComponent
,Releasable
,Repository
public class FilterRepository extends java.lang.Object implements Repository
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.repositories.Repository
Repository.Factory
-
-
Constructor Summary
Constructors Constructor Description FilterRepository(Repository in)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLifecycleListener(LifecycleListener listener)
void
close()
void
deleteSnapshot(SnapshotId snapshotId, long repositoryStateId)
Deletes snapshotvoid
endVerification(java.lang.String verificationToken)
Called at the end of repository verification process.SnapshotInfo
finalizeSnapshot(SnapshotId snapshotId, java.util.List<IndexId> indices, long startTime, java.lang.String failure, int totalShards, java.util.List<SnapshotShardFailure> shardFailures, long repositoryStateId, boolean includeGlobalState)
Finalizes snapshotting processRepositoryMetaData
getMetadata()
Returns metadata about this repository.RepositoryData
getRepositoryData()
Returns aRepositoryData
to describe the data in the repository, including the snapshots and the indices across all snapshots found in the repository.long
getRestoreThrottleTimeInNanos()
Returns restore throttle time in nanosecondsIndexShardSnapshotStatus
getShardSnapshotStatus(SnapshotId snapshotId, Version version, IndexId indexId, ShardId shardId)
Retrieve shard snapshot status for the stored snapshotMetaData
getSnapshotGlobalMetaData(SnapshotId snapshotId)
Returns global metadata associated with the snapshot.IndexMetaData
getSnapshotIndexMetaData(SnapshotId snapshotId, IndexId index)
Returns the index metadata associated with the snapshot.SnapshotInfo
getSnapshotInfo(SnapshotId snapshotId)
Reads snapshot description from repository.long
getSnapshotThrottleTimeInNanos()
Returns snapshot throttle time in nanosecondsvoid
initializeSnapshot(SnapshotId snapshotId, java.util.List<IndexId> indices, MetaData metaData)
Starts snapshotting processboolean
isReadOnly()
Returns true if the repository supports only read operationsLifecycle.State
lifecycleState()
void
removeLifecycleListener(LifecycleListener listener)
void
restoreShard(IndexShard shard, SnapshotId snapshotId, Version version, IndexId indexId, ShardId snapshotShardId, RecoveryState recoveryState)
Restores snapshot of the shard.void
snapshotShard(IndexShard shard, Store store, SnapshotId snapshotId, IndexId indexId, org.apache.lucene.index.IndexCommit snapshotIndexCommit, IndexShardSnapshotStatus snapshotStatus)
Creates a snapshot of the shard based on the index commit point.void
start()
java.lang.String
startVerification()
Verifies repository on the master node and returns the verification token.void
stop()
void
verify(java.lang.String verificationToken, DiscoveryNode localNode)
Verifies repository settings on data node.
-
-
-
Constructor Detail
-
FilterRepository
public FilterRepository(Repository in)
-
-
Method Detail
-
getMetadata
public RepositoryMetaData getMetadata()
Description copied from interface:Repository
Returns metadata about this repository.- Specified by:
getMetadata
in interfaceRepository
-
getSnapshotInfo
public SnapshotInfo getSnapshotInfo(SnapshotId snapshotId)
Description copied from interface:Repository
Reads snapshot description from repository.- Specified by:
getSnapshotInfo
in interfaceRepository
- Parameters:
snapshotId
- snapshot id- Returns:
- information about snapshot
-
getSnapshotGlobalMetaData
public MetaData getSnapshotGlobalMetaData(SnapshotId snapshotId)
Description copied from interface:Repository
Returns global metadata associated with the snapshot.- Specified by:
getSnapshotGlobalMetaData
in interfaceRepository
- Parameters:
snapshotId
- the snapshot id to load the global metadata from- Returns:
- the global metadata about the snapshot
-
getSnapshotIndexMetaData
public IndexMetaData getSnapshotIndexMetaData(SnapshotId snapshotId, IndexId index) throws java.io.IOException
Description copied from interface:Repository
Returns the index metadata associated with the snapshot.- Specified by:
getSnapshotIndexMetaData
in interfaceRepository
- Parameters:
snapshotId
- the snapshot id to load the index metadata fromindex
- theIndexId
to load the metadata from- Returns:
- the index metadata about the given index for the given snapshot
- Throws:
java.io.IOException
-
getRepositoryData
public RepositoryData getRepositoryData()
Description copied from interface:Repository
Returns aRepositoryData
to describe the data in the repository, including the snapshots and the indices across all snapshots found in the repository. Throws aRepositoryException
if there was an error in reading the data.- Specified by:
getRepositoryData
in interfaceRepository
-
initializeSnapshot
public void initializeSnapshot(SnapshotId snapshotId, java.util.List<IndexId> indices, MetaData metaData)
Description copied from interface:Repository
Starts snapshotting process- Specified by:
initializeSnapshot
in interfaceRepository
- Parameters:
snapshotId
- snapshot idindices
- list of indices to be snapshottedmetaData
- cluster metadata
-
finalizeSnapshot
public SnapshotInfo finalizeSnapshot(SnapshotId snapshotId, java.util.List<IndexId> indices, long startTime, java.lang.String failure, int totalShards, java.util.List<SnapshotShardFailure> shardFailures, long repositoryStateId, boolean includeGlobalState)
Description copied from interface:Repository
Finalizes snapshotting processThis method is called on master after all shards are snapshotted.
- Specified by:
finalizeSnapshot
in interfaceRepository
- Parameters:
snapshotId
- snapshot idindices
- list of indices in the snapshotstartTime
- start time of the snapshotfailure
- global failure reason or nulltotalShards
- total number of shardsshardFailures
- list of shard failuresrepositoryStateId
- the unique id identifying the state of the repository when the snapshot beganincludeGlobalState
- include cluster global state- Returns:
- snapshot description
-
deleteSnapshot
public void deleteSnapshot(SnapshotId snapshotId, long repositoryStateId)
Description copied from interface:Repository
Deletes snapshot- Specified by:
deleteSnapshot
in interfaceRepository
- Parameters:
snapshotId
- snapshot idrepositoryStateId
- the unique id identifying the state of the repository when the snapshot deletion began
-
getSnapshotThrottleTimeInNanos
public long getSnapshotThrottleTimeInNanos()
Description copied from interface:Repository
Returns snapshot throttle time in nanoseconds- Specified by:
getSnapshotThrottleTimeInNanos
in interfaceRepository
-
getRestoreThrottleTimeInNanos
public long getRestoreThrottleTimeInNanos()
Description copied from interface:Repository
Returns restore throttle time in nanoseconds- Specified by:
getRestoreThrottleTimeInNanos
in interfaceRepository
-
startVerification
public java.lang.String startVerification()
Description copied from interface:Repository
Verifies repository on the master node and returns the verification token.If the verification token is not null, it's passed to all data nodes for verification. If it's null - no additional verification is required
- Specified by:
startVerification
in interfaceRepository
- Returns:
- verification token that should be passed to all Index Shard Repositories for additional verification or null
-
endVerification
public void endVerification(java.lang.String verificationToken)
Description copied from interface:Repository
Called at the end of repository verification process.This method should perform all necessary cleanup of the temporary files created in the repository
- Specified by:
endVerification
in interfaceRepository
- Parameters:
verificationToken
- verification request generated byRepository.startVerification()
command
-
verify
public void verify(java.lang.String verificationToken, DiscoveryNode localNode)
Description copied from interface:Repository
Verifies repository settings on data node.- Specified by:
verify
in interfaceRepository
- Parameters:
verificationToken
- value returned byRepository.startVerification()
localNode
- the local node information, for inclusion in verification errors
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:Repository
Returns true if the repository supports only read operations- Specified by:
isReadOnly
in interfaceRepository
- Returns:
- true if the repository is read/only
-
snapshotShard
public void snapshotShard(IndexShard shard, Store store, SnapshotId snapshotId, IndexId indexId, org.apache.lucene.index.IndexCommit snapshotIndexCommit, IndexShardSnapshotStatus snapshotStatus)
Description copied from interface:Repository
Creates a snapshot of the shard based on the index commit point.The index commit point can be obtained by using
Engine.acquireLastIndexCommit(boolean)
method. Repository implementations shouldn't release the snapshot index commit point. It is done by the method caller.As snapshot process progresses, implementation of this method should update
IndexShardSnapshotStatus
object and checkIndexShardSnapshotStatus.isAborted()
to see if the snapshot process should be aborted.- Specified by:
snapshotShard
in interfaceRepository
- Parameters:
shard
- shard to be snapshottedstore
- store to be snapshottedsnapshotId
- snapshot idindexId
- id for the index being snapshottedsnapshotIndexCommit
- commit pointsnapshotStatus
- snapshot status
-
restoreShard
public void restoreShard(IndexShard shard, SnapshotId snapshotId, Version version, IndexId indexId, ShardId snapshotShardId, RecoveryState recoveryState)
Description copied from interface:Repository
Restores snapshot of the shard.The index can be renamed on restore, hence different
shardId
andsnapshotShardId
are supplied.- Specified by:
restoreShard
in interfaceRepository
- Parameters:
shard
- the shard to restore the index intosnapshotId
- snapshot idversion
- version of elasticsearch that created this snapshotindexId
- id of the index in the repository from which the restore is occurringsnapshotShardId
- shard id (in the snapshot)recoveryState
- recovery state
-
getShardSnapshotStatus
public IndexShardSnapshotStatus getShardSnapshotStatus(SnapshotId snapshotId, Version version, IndexId indexId, ShardId shardId)
Description copied from interface:Repository
Retrieve shard snapshot status for the stored snapshot- Specified by:
getShardSnapshotStatus
in interfaceRepository
- Parameters:
snapshotId
- snapshot idversion
- version of elasticsearch that created this snapshotindexId
- the snapshotted index id for the shard to get status forshardId
- shard id- Returns:
- snapshot status
-
lifecycleState
public Lifecycle.State lifecycleState()
- Specified by:
lifecycleState
in interfaceLifecycleComponent
-
addLifecycleListener
public void addLifecycleListener(LifecycleListener listener)
- Specified by:
addLifecycleListener
in interfaceLifecycleComponent
-
removeLifecycleListener
public void removeLifecycleListener(LifecycleListener listener)
- Specified by:
removeLifecycleListener
in interfaceLifecycleComponent
-
start
public void start()
- Specified by:
start
in interfaceLifecycleComponent
-
stop
public void stop()
- Specified by:
stop
in interfaceLifecycleComponent
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceReleasable
-
-