Class ReplicationTarget

java.lang.Object
org.opensearch.common.util.concurrent.AbstractRefCounted
org.opensearch.indices.replication.common.ReplicationTarget
All Implemented Interfaces:
org.opensearch.common.util.concurrent.RefCounted
Direct Known Subclasses:
RecoveryTarget, SegmentReplicationTarget

public abstract class ReplicationTarget extends org.opensearch.common.util.concurrent.AbstractRefCounted
Represents the target of a replication operation performed on a shard
Opensearch.internal:
  • Field Details

  • Constructor Details

  • Method Details

    • getPrefix

      protected abstract String getPrefix()
    • onDone

      protected abstract void onDone()
    • onCancel

      protected void onCancel(String reason)
    • state

      public abstract ReplicationState state()
    • retryCopy

      public abstract ReplicationTarget retryCopy()
    • description

      public abstract String description()
    • getListener

      public ReplicationListener getListener()
    • cancellableThreads

      public CancellableThreads cancellableThreads()
    • notifyListener

      public abstract void notifyListener(ReplicationFailedException e, boolean sendShardFailure)
    • getId

      public long getId()
    • reset

      public abstract boolean reset(CancellableThreads newTargetCancellableThreads) throws IOException
      Throws:
      IOException
    • lastAccessTime

      public long lastAccessTime()
      return the last time this ReplicationStatus was used (based on System.nanoTime()
    • setLastAccessTime

      public void setLastAccessTime()
      sets the lasAccessTime flag to now
    • markRequestReceivedAndCreateListener

      @Nullable public org.opensearch.core.action.ActionListener<Void> markRequestReceivedAndCreateListener(long requestSeqNo, org.opensearch.core.action.ActionListener<Void> listener)
    • indexShard

      public IndexShard indexShard()
    • store

      public Store store()
    • shardId

      public org.opensearch.core.index.shard.ShardId shardId()
    • markAsDone

      public void markAsDone()
      mark the current replication as done
    • cancel

      public void cancel(String reason)
      cancel the replication. calling this method will clean temporary files and release the store unless this object is in use (in which case it will be cleaned once all ongoing users call AbstractRefCounted.decRef()
    • fail

      public void fail(ReplicationFailedException e, boolean sendShardFailure)
      fail the replication and call listener
      Parameters:
      e - exception that encapsulates the failure
      sendShardFailure - indicates whether to notify the master of the shard failure
    • ensureRefCount

      protected void ensureRefCount()
    • createOrFinishListener

      @Nullable public org.opensearch.core.action.ActionListener<Void> createOrFinishListener(TransportChannel channel, String action, RecoveryTransportRequest request)
    • createOrFinishListener

      @Nullable public org.opensearch.core.action.ActionListener<Void> createOrFinishListener(TransportChannel channel, String action, RecoveryTransportRequest request, org.opensearch.common.CheckedFunction<Void,org.opensearch.core.transport.TransportResponse,Exception> responseFn)
    • handleFileChunk

      public void handleFileChunk(FileChunkRequest request, ReplicationTarget replicationTarget, AtomicLong bytesSinceLastPause, org.apache.lucene.store.RateLimiter rateLimiter, org.opensearch.core.action.ActionListener<Void> listener) throws IOException
      Handle a FileChunkRequest for a ReplicationTarget.
      Parameters:
      request - FileChunkRequest Request containing the file chunk.
      bytesSinceLastPause - AtomicLong Bytes since the last pause.
      rateLimiter - RateLimiter Rate limiter.
      listener - ActionListener listener that completes when the chunk has been written.
      Throws:
      IOException - When there is an issue pausing the rate limiter.
    • writeFileChunk

      public abstract void writeFileChunk(StoreFileMetadata metadata, long position, org.opensearch.core.common.bytes.BytesReference content, boolean lastChunk, int totalTranslogOps, org.opensearch.core.action.ActionListener<Void> listener)
    • closeInternal

      protected void closeInternal()
      Specified by:
      closeInternal in class org.opensearch.common.util.concurrent.AbstractRefCounted