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
  • Constructor Details

    • FilterRepository

      public FilterRepository​(Repository in)
  • Method Details

    • getDelegate

      public Repository getDelegate()
    • getMetadata

      public RepositoryMetadata getMetadata()
      Description copied from interface: Repository
      Returns metadata about this repository.
      Specified by:
      getMetadata in interface Repository
    • getSnapshotInfo

      public SnapshotInfo getSnapshotInfo​(SnapshotId snapshotId)
      Description copied from interface: Repository
      Reads snapshot description from repository.
      Specified by:
      getSnapshotInfo in interface Repository
      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 interface Repository
      Parameters:
      snapshotId - the snapshot id to load the global metadata from
      Returns:
      the global metadata about the snapshot
    • getSnapshotIndexMetaData

      public IndexMetadata getSnapshotIndexMetaData​(RepositoryData repositoryData, 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 interface Repository
      Parameters:
      repositoryData - current RepositoryData
      snapshotId - the snapshot id to load the index metadata from
      index - the IndexId to load the metadata from
      Returns:
      the index metadata about the given index for the given snapshot
      Throws:
      java.io.IOException
    • getRepositoryData

      public void getRepositoryData​(ActionListener<RepositoryData> listener)
      Description copied from interface: Repository
      Returns a RepositoryData to describe the data in the repository, including the snapshots and the indices across all snapshots found in the repository. Throws a RepositoryException if there was an error in reading the data.
      Specified by:
      getRepositoryData in interface Repository
      Parameters:
      listener - listener that may be resolved on different kinds of threads including transport and cluster state applier threads and therefore must fork to a new thread for executing any long running actions
    • 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 interface Repository
      Parameters:
      snapshotId - snapshot id
      indices - list of indices to be snapshotted
      metadata - cluster metadata
    • finalizeSnapshot

      public void finalizeSnapshot​(ShardGenerations shardGenerations, long repositoryStateId, Metadata clusterMetadata, SnapshotInfo snapshotInfo, Version repositoryMetaVersion, java.util.function.Function<ClusterState,​ClusterState> stateTransformer, ActionListener<RepositoryData> listener)
      Description copied from interface: Repository
      Finalizes snapshotting process

      This method is called on master after all shards are snapshotted.

      Specified by:
      finalizeSnapshot in interface Repository
      Parameters:
      shardGenerations - updated shard generations
      repositoryStateId - the unique id identifying the state of the repository when the snapshot began
      clusterMetadata - cluster metadata
      snapshotInfo - SnapshotInfo instance to write for this snapshot
      repositoryMetaVersion - version of the updated repository metadata to write
      stateTransformer - a function that filters the last cluster state update that the snapshot finalization will execute and is used to remove any state tracked for the in-progress snapshot from the cluster state
      listener - listener to be invoked with the new RepositoryData after completing the snapshot
    • deleteSnapshots

      public void deleteSnapshots​(java.util.Collection<SnapshotId> snapshotIds, long repositoryStateId, Version repositoryMetaVersion, ActionListener<RepositoryData> listener)
      Description copied from interface: Repository
      Deletes snapshots
      Specified by:
      deleteSnapshots in interface Repository
      Parameters:
      snapshotIds - snapshot ids
      repositoryStateId - the unique id identifying the state of the repository when the snapshot deletion began
      repositoryMetaVersion - version of the updated repository metadata to write
      listener - completion listener
    • getSnapshotThrottleTimeInNanos

      public long getSnapshotThrottleTimeInNanos()
      Description copied from interface: Repository
      Returns snapshot throttle time in nanoseconds
      Specified by:
      getSnapshotThrottleTimeInNanos in interface Repository
    • getRestoreThrottleTimeInNanos

      public long getRestoreThrottleTimeInNanos()
      Description copied from interface: Repository
      Returns restore throttle time in nanoseconds
      Specified by:
      getRestoreThrottleTimeInNanos in interface Repository
    • 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 interface Repository
      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 interface Repository
      Parameters:
      verificationToken - verification request generated by Repository.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 interface Repository
      Parameters:
      verificationToken - value returned by Repository.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 interface Repository
      Returns:
      true if the repository is read/only
    • snapshotShard

      public void snapshotShard​(Store store, MapperService mapperService, SnapshotId snapshotId, IndexId indexId, org.apache.lucene.index.IndexCommit snapshotIndexCommit, java.lang.String shardStateIdentifier, IndexShardSnapshotStatus snapshotStatus, Version repositoryMetaVersion, java.util.Map<java.lang.String,​java.lang.Object> userMetadata, ActionListener<java.lang.String> listener)
      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 check IndexShardSnapshotStatus.isAborted() to see if the snapshot process should be aborted.

      Specified by:
      snapshotShard in interface Repository
      Parameters:
      store - store to be snapshotted
      mapperService - the shards mapper service
      snapshotId - snapshot id
      indexId - id for the index being snapshotted
      snapshotIndexCommit - commit point
      shardStateIdentifier - a unique identifier of the state of the shard that is stored with the shard's snapshot and used to detect if the shard has changed between snapshots. If null is passed as the identifier snapshotting will be done by inspecting the physical files referenced by snapshotIndexCommit
      snapshotStatus - snapshot status
      repositoryMetaVersion - version of the updated repository metadata to write
      userMetadata - user metadata of the snapshot found in SnapshotsInProgress.Entry.userMetadata()
      listener - listener invoked on completion
    • restoreShard

      public void restoreShard​(Store store, SnapshotId snapshotId, IndexId indexId, ShardId snapshotShardId, RecoveryState recoveryState, ActionListener<java.lang.Void> listener)
      Description copied from interface: Repository
      Restores snapshot of the shard.

      The index can be renamed on restore, hence different shardId and snapshotShardId are supplied.

      Specified by:
      restoreShard in interface Repository
      Parameters:
      store - the store to restore the index into
      snapshotId - snapshot id
      indexId - id of the index in the repository from which the restore is occurring
      snapshotShardId - shard id (in the snapshot)
      recoveryState - recovery state
      listener - listener to invoke once done
    • getShardSnapshotStatus

      public IndexShardSnapshotStatus getShardSnapshotStatus​(SnapshotId snapshotId, IndexId indexId, ShardId shardId)
      Description copied from interface: Repository
      Retrieve shard snapshot status for the stored snapshot
      Specified by:
      getShardSnapshotStatus in interface Repository
      Parameters:
      snapshotId - snapshot id
      indexId - the snapshotted index id for the shard to get status for
      shardId - shard id
      Returns:
      snapshot status
    • updateState

      public void updateState​(ClusterState state)
      Description copied from interface: Repository
      Update the repository with the incoming cluster state. This method is invoked from RepositoriesService.applyClusterState(org.elasticsearch.cluster.ClusterChangedEvent) and thus the same semantics as with ClusterStateApplier.applyClusterState(org.elasticsearch.cluster.ClusterChangedEvent) apply for the ClusterState that is passed here.
      Specified by:
      updateState in interface Repository
      Parameters:
      state - new cluster state
    • executeConsistentStateUpdate

      public void executeConsistentStateUpdate​(java.util.function.Function<RepositoryData,​ClusterStateUpdateTask> createUpdateTask, java.lang.String source, java.util.function.Consumer<java.lang.Exception> onFailure)
      Description copied from interface: Repository
      Execute a cluster state update with a consistent view of the current RepositoryData. The ClusterState passed to the task generated through createUpdateTask is guaranteed to point at the same state for this repository as the did the state at the time the RepositoryData was loaded. This allows for operations on the repository that need a consistent view of both the cluster state and the repository contents at one point in time like for example, checking if a snapshot is in the repository before adding the delete operation for it to the cluster state.
      Specified by:
      executeConsistentStateUpdate in interface Repository
      Parameters:
      createUpdateTask - function to supply cluster state update task
      source - the source of the cluster state update task
      onFailure - error handler invoked on failure to get a consistent view of the current RepositoryData
    • cloneShardSnapshot

      public void cloneShardSnapshot​(SnapshotId source, SnapshotId target, RepositoryShardId shardId, java.lang.String shardGeneration, ActionListener<java.lang.String> listener)
      Description copied from interface: Repository
      Clones a shard snapshot.
      Specified by:
      cloneShardSnapshot in interface Repository
      Parameters:
      source - source snapshot
      target - target snapshot
      shardId - shard id
      shardGeneration - shard generation in repo
      listener - listener to complete with new shard generation once clone has completed
    • lifecycleState

      public Lifecycle.State lifecycleState()
      Specified by:
      lifecycleState in interface LifecycleComponent
    • addLifecycleListener

      public void addLifecycleListener​(LifecycleListener listener)
      Specified by:
      addLifecycleListener in interface LifecycleComponent
    • removeLifecycleListener

      public void removeLifecycleListener​(LifecycleListener listener)
      Specified by:
      removeLifecycleListener in interface LifecycleComponent
    • start

      public void start()
      Specified by:
      start in interface LifecycleComponent
    • stop

      public void stop()
      Specified by:
      stop in interface LifecycleComponent
    • close

      public void close()
      Specified by:
      close in interface java.lang.AutoCloseable
      Specified by:
      close in interface java.io.Closeable
      Specified by:
      close in interface Releasable