Interface Repository

All Superinterfaces:
java.lang.AutoCloseable,, LifecycleComponent, Releasable
All Known Implementing Classes:
BlobStoreRepository, FilterRepository, FsRepository

public interface Repository
extends LifecycleComponent
  • Method Details

    • getMetadata

      RepositoryMetaData getMetadata()
      Returns metadata about this repository.
    • getSnapshotInfo

      SnapshotInfo getSnapshotInfo​(SnapshotId snapshotId)
      Reads snapshot description from repository.
      snapshotId - snapshot id
      information about snapshot
    • getSnapshotGlobalMetaData

      MetaData getSnapshotGlobalMetaData​(SnapshotId snapshotId)
      Returns global metadata associated with the snapshot.
      snapshotId - the snapshot id to load the global metadata from
      the global metadata about the snapshot
    • getSnapshotIndexMetaData

      IndexMetaData getSnapshotIndexMetaData​(SnapshotId snapshotId, IndexId index) throws
      Returns the index metadata associated with the snapshot.
      snapshotId - the snapshot id to load the index metadata from
      index - the IndexId to load the metadata from
      the index metadata about the given index for the given snapshot
    • getRepositoryData

      void getRepositoryData​(ActionListener<RepositoryData> listener)
      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.
    • initializeSnapshot

      @Deprecated void initializeSnapshot​(SnapshotId snapshotId, java.util.List<IndexId> indices, MetaData metaData)
      this method is only used when taking snapshots in a mixed version cluster where a master node older than SnapshotsService.NO_REPO_INITIALIZE_VERSION is present.
      Starts snapshotting process
      snapshotId - snapshot id
      indices - list of indices to be snapshotted
      metaData - cluster metadata
    • finalizeSnapshot

      void finalizeSnapshot​(SnapshotId snapshotId, ShardGenerations shardGenerations, long startTime, java.lang.String failure, int totalShards, java.util.List<SnapshotShardFailure> shardFailures, long repositoryStateId, boolean includeGlobalState, MetaData clusterMetaData, java.util.Map<java.lang.String,​java.lang.Object> userMetadata, boolean writeShardGens, ActionListener<SnapshotInfo> listener)
      Finalizes snapshotting process

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

      snapshotId - snapshot id
      shardGenerations - updated shard generations
      startTime - start time of the snapshot
      failure - global failure reason or null
      totalShards - total number of shards
      shardFailures - list of shard failures
      repositoryStateId - the unique id identifying the state of the repository when the snapshot began
      includeGlobalState - include cluster global state
      clusterMetaData - cluster metadata
      userMetadata - user metadata
      writeShardGens - if shard generations should be written to the repository
      listener - listener to be called on completion of the snapshot
    • deleteSnapshot

      void deleteSnapshot​(SnapshotId snapshotId, long repositoryStateId, boolean writeShardGens, ActionListener<java.lang.Void> listener)
      Deletes snapshot
      snapshotId - snapshot id
      repositoryStateId - the unique id identifying the state of the repository when the snapshot deletion began
      writeShardGens - if shard generations should be written to the repository
      listener - completion listener
    • getSnapshotThrottleTimeInNanos

      long getSnapshotThrottleTimeInNanos()
      Returns snapshot throttle time in nanoseconds
    • getRestoreThrottleTimeInNanos

      long getRestoreThrottleTimeInNanos()
      Returns restore throttle time in nanoseconds
    • startVerification

      java.lang.String startVerification()
      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

      verification token that should be passed to all Index Shard Repositories for additional verification or null
    • endVerification

      void endVerification​(java.lang.String verificationToken)
      Called at the end of repository verification process.

      This method should perform all necessary cleanup of the temporary files created in the repository

      verificationToken - verification request generated by startVerification() command
    • verify

      void verify​(java.lang.String verificationToken, DiscoveryNode localNode)
      Verifies repository settings on data node.
      verificationToken - value returned by startVerification()
      localNode - the local node information, for inclusion in verification errors
    • isReadOnly

      boolean isReadOnly()
      Returns true if the repository supports only read operations
      true if the repository is read/only
    • snapshotShard

      void snapshotShard​(Store store, MapperService mapperService, SnapshotId snapshotId, IndexId indexId, org.apache.lucene.index.IndexCommit snapshotIndexCommit, IndexShardSnapshotStatus snapshotStatus, boolean writeShardGens, ActionListener<java.lang.String> listener)
      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.

      store - store to be snapshotted
      mapperService - the shards mapper service
      snapshotId - snapshot id
      indexId - id for the index being snapshotted
      snapshotIndexCommit - commit point
      snapshotStatus - snapshot status
      listener - listener invoked on completion
    • restoreShard

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

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

      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

      IndexShardSnapshotStatus getShardSnapshotStatus​(SnapshotId snapshotId, IndexId indexId, ShardId shardId)
      Retrieve shard snapshot status for the stored snapshot
      snapshotId - snapshot id
      indexId - the snapshotted index id for the shard to get status for
      shardId - shard id
      snapshot status
    • updateState

      void updateState​(ClusterState state)
      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.
      state - new cluster state