Class TransportBroadcastByNodeAction<Request extends BroadcastRequest<Request>,Response extends BroadcastResponse,ShardOperationResult extends Writeable>
java.lang.Object
org.elasticsearch.action.support.TransportAction<Request,Response>
org.elasticsearch.action.support.HandledTransportAction<Request,Response>
org.elasticsearch.action.support.broadcast.node.TransportBroadcastByNodeAction<Request,Response,ShardOperationResult>
- Type Parameters:
Request
- the underlying client requestResponse
- the response to the client requestShardOperationResult
- per-shard operation results
- Direct Known Subclasses:
TransportClearIndicesCacheAction
,TransportForceMergeAction
,TransportIndicesSegmentsAction
,TransportIndicesStatsAction
,TransportRecoveryAction
,TransportUpgradeAction
,TransportUpgradeStatusAction
public abstract class TransportBroadcastByNodeAction<Request extends BroadcastRequest<Request>,Response extends BroadcastResponse,ShardOperationResult extends Writeable> extends HandledTransportAction<Request,Response>
Abstraction for transporting aggregated shard-level operations in a single request (NodeRequest) per-node
and executing the shard-level operations serially on the receiving node. Each shard-level operation can produce a
result (ShardOperationResult), these per-node shard-level results are aggregated into a single result
(BroadcastByNodeResponse) to the coordinating node. These per-node results are aggregated into a single result (Result)
to the client.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
TransportBroadcastByNodeAction.AsyncAction
static class
TransportBroadcastByNodeAction.EmptyResult
Can be used for implementations ofshardOperation
for which there is no shard-level return value.class
TransportBroadcastByNodeAction.NodeRequest
-
Field Summary
Fields inherited from class org.elasticsearch.action.support.TransportAction
actionName, localConnection, logger, taskManager
-
Constructor Summary
Constructors Constructor Description TransportBroadcastByNodeAction(java.lang.String actionName, ClusterService clusterService, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<Request> request, java.lang.String executor)
TransportBroadcastByNodeAction(java.lang.String actionName, ClusterService clusterService, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<Request> request, java.lang.String executor, boolean canTripCircuitBreaker)
-
Method Summary
Modifier and Type Method Description protected abstract ClusterBlockException
checkGlobalBlock(ClusterState state, Request request)
Executes a global block check before polling the cluster state.protected abstract ClusterBlockException
checkRequestBlock(ClusterState state, Request request, java.lang.String[] concreteIndices)
Executes a global request-level check before polling the cluster state.protected void
doExecute(Task task, Request request, ActionListener<Response> listener)
protected abstract Response
newResponse(Request request, int totalShards, int successfulShards, int failedShards, java.util.List<ShardOperationResult> results, java.util.List<DefaultShardOperationFailedException> shardFailures, ClusterState clusterState)
Creates a new response to the underlying request.protected abstract Request
readRequestFrom(StreamInput in)
Deserialize a request from an input streamprotected abstract ShardOperationResult
readShardResult(StreamInput in)
Deserialize a shard-level result from an input streamprotected java.lang.String[]
resolveConcreteIndexNames(ClusterState clusterState, Request request)
Resolves a list of concrete index names.protected abstract ShardOperationResult
shardOperation(Request request, ShardRouting shardRouting, Task task)
Executes the shard-level operation.protected abstract ShardsIterator
shards(ClusterState clusterState, Request request, java.lang.String[] concreteIndices)
Determines the shards on which this operation will be executed on.Methods inherited from class org.elasticsearch.action.support.TransportAction
execute, execute, execute
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
TransportBroadcastByNodeAction
public TransportBroadcastByNodeAction(java.lang.String actionName, ClusterService clusterService, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<Request> request, java.lang.String executor) -
TransportBroadcastByNodeAction
public TransportBroadcastByNodeAction(java.lang.String actionName, ClusterService clusterService, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<Request> request, java.lang.String executor, boolean canTripCircuitBreaker)
-
-
Method Details
-
readShardResult
Deserialize a shard-level result from an input stream- Parameters:
in
- input stream- Returns:
- a deserialized shard-level result
- Throws:
java.io.IOException
-
newResponse
protected abstract Response newResponse(Request request, int totalShards, int successfulShards, int failedShards, java.util.List<ShardOperationResult> results, java.util.List<DefaultShardOperationFailedException> shardFailures, ClusterState clusterState)Creates a new response to the underlying request.- Parameters:
request
- the underlying requesttotalShards
- the total number of shards considered for execution of the operationsuccessfulShards
- the total number of shards for which execution of the operation was successfulfailedShards
- the total number of shards for which execution of the operation failedresults
- the per-node aggregated shard-level resultsshardFailures
- the exceptions corresponding to shard operation failuresclusterState
- the cluster state- Returns:
- the response
-
readRequestFrom
Deserialize a request from an input stream- Parameters:
in
- input stream- Returns:
- a de-serialized request
- Throws:
java.io.IOException
-
shardOperation
protected abstract ShardOperationResult shardOperation(Request request, ShardRouting shardRouting, Task task) throws java.io.IOExceptionExecutes the shard-level operation. This method is called once per shard serially on the receiving node.- Parameters:
request
- the node-level requestshardRouting
- the shard on which to execute the operationtask
- the task for this node-level request- Returns:
- the result of the shard-level operation for the shard
- Throws:
java.io.IOException
-
shards
protected abstract ShardsIterator shards(ClusterState clusterState, Request request, java.lang.String[] concreteIndices)Determines the shards on which this operation will be executed on. The operation is executed once per shard.- Parameters:
clusterState
- the cluster staterequest
- the underlying requestconcreteIndices
- the concrete indices on which to execute the operation- Returns:
- the shards on which to execute the operation
-
checkGlobalBlock
Executes a global block check before polling the cluster state.- Parameters:
state
- the cluster staterequest
- the underlying request- Returns:
- a non-null exception if the operation is blocked
-
checkRequestBlock
protected abstract ClusterBlockException checkRequestBlock(ClusterState state, Request request, java.lang.String[] concreteIndices)Executes a global request-level check before polling the cluster state.- Parameters:
state
- the cluster staterequest
- the underlying requestconcreteIndices
- the concrete indices on which to execute the operation- Returns:
- a non-null exception if the operation if blocked
-
resolveConcreteIndexNames
Resolves a list of concrete index names. Override this if index names should be resolved differently than normal.- Parameters:
clusterState
- the cluster staterequest
- the underlying request- Returns:
- a list of concrete index names that this action should operate on
-
doExecute
- Specified by:
doExecute
in classTransportAction<Request extends BroadcastRequest<Request>,Response extends BroadcastResponse>
-