public abstract class ReplicationRequest<Request extends ReplicationRequest<Request>> extends ActionRequest implements IndicesRequest
IndexRequest
or
TransportShardRefreshAction
.TransportRequest.Empty
IndicesRequest.Replaceable
Modifier and Type | Field and Description |
---|---|
static TimeValue |
DEFAULT_TIMEOUT |
protected java.lang.String |
index |
protected ShardId |
shardId
Target shard the request should execute on.
|
protected TimeValue |
timeout |
protected ActiveShardCount |
waitForActiveShards
The number of shard copies that must be active before proceeding with the replication action.
|
Constructor and Description |
---|
ReplicationRequest() |
ReplicationRequest(ShardId shardId)
Creates a new request with resolved shard id
|
Modifier and Type | Method and Description |
---|---|
Task |
createTask(long id,
java.lang.String type,
java.lang.String action,
TaskId parentTaskId)
Returns the task object that should be used to keep track of the processing of the request.
|
java.lang.String |
getDescription()
Returns optional description of the request to be displayed by the task manager
|
java.lang.String |
index() |
Request |
index(java.lang.String index) |
java.lang.String[] |
indices()
Returns the array of indices that the action relates to
|
IndicesOptions |
indicesOptions()
Returns the indices options used to resolve indices.
|
void |
onRetry()
This method is called before this replication request is retried
the first time.
|
void |
readFrom(StreamInput in)
Set this object's fields from a StreamInput.
|
Request |
setShardId(ShardId shardId)
Sets the target shard id for the request.
|
ShardId |
shardId() |
TimeValue |
timeout() |
Request |
timeout(java.lang.String timeout)
A timeout to wait if the index operation can't be performed immediately.
|
Request |
timeout(TimeValue timeout)
A timeout to wait if the index operation can't be performed immediately.
|
java.lang.String |
toString() |
ActionRequestValidationException |
validate() |
ActiveShardCount |
waitForActiveShards() |
Request |
waitForActiveShards(ActiveShardCount waitForActiveShards)
Sets the number of shard copies that must be active before proceeding with the replication
operation.
|
Request |
waitForActiveShards(int waitForActiveShards)
A shortcut for
waitForActiveShards(ActiveShardCount) where the numerical
shard count is passed in, instead of having to first call ActiveShardCount.from(int)
to get the ActiveShardCount. |
void |
writeTo(StreamOutput out)
Write this object's fields to a StreamOutput.
|
getShouldStoreResult
getParentTask, setParentTask
remoteAddress, remoteAddress
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
setParentTask
public static final TimeValue DEFAULT_TIMEOUT
protected ShardId shardId
protected TimeValue timeout
protected java.lang.String index
protected ActiveShardCount waitForActiveShards
public ReplicationRequest()
public ReplicationRequest(ShardId shardId)
public final Request timeout(TimeValue timeout)
public final Request timeout(java.lang.String timeout)
public TimeValue timeout()
public java.lang.String index()
public final Request index(java.lang.String index)
public java.lang.String[] indices()
IndicesRequest
indices
in interface IndicesRequest
public IndicesOptions indicesOptions()
IndicesRequest
indicesOptions
in interface IndicesRequest
public ActiveShardCount waitForActiveShards()
@Nullable public ShardId shardId()
public final Request waitForActiveShards(ActiveShardCount waitForActiveShards)
ActiveShardCount.DEFAULT
, which requires one shard copy
(the primary) to be active. Set this value to ActiveShardCount.ALL
to
wait for all shards (primary and all replicas) to be active. Otherwise, use
ActiveShardCount.from(int)
to set this value to any non-negative integer, up to the
total number of shard copies (number of replicas + 1).public final Request waitForActiveShards(int waitForActiveShards)
waitForActiveShards(ActiveShardCount)
where the numerical
shard count is passed in, instead of having to first call ActiveShardCount.from(int)
to get the ActiveShardCount.public ActionRequestValidationException validate()
validate
in class ActionRequest
public void readFrom(StreamInput in) throws java.io.IOException
Streamable
readFrom
in interface Streamable
readFrom
in class ActionRequest
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Streamable
writeTo
in interface Streamable
writeTo
in class ActionRequest
java.io.IOException
public Task createTask(long id, java.lang.String type, java.lang.String action, TaskId parentTaskId)
TaskAwareRequest
createTask
in interface TaskAwareRequest
public Request setShardId(ShardId shardId)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getDescription()
TaskAwareRequest
getDescription
in interface TaskAwareRequest
public void onRetry()