Module org.elasticsearch.server
Class TransportBroadcastByNodeAction<Request extends BroadcastRequest<Request>,Response extends BaseBroadcastResponse,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,TransportFieldUsageAction,TransportForceMergeAction,TransportIndicesSegmentsAction,TransportIndicesStatsAction,TransportRecoveryAction,TransportReloadAnalyzersAction
public abstract class TransportBroadcastByNodeAction<Request extends BroadcastRequest<Request>,Response extends BaseBroadcastResponse,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 ClassesModifier and TypeClassDescriptionstatic final classCan be used for implementations ofshardOperationfor which there is no shard-level return value.classstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ClusterServiceprotected final IndexNameExpressionResolverprotected final TransportServiceFields inherited from class org.elasticsearch.action.support.TransportAction
actionName, taskManager -
Constructor Summary
ConstructorsConstructorDescriptionTransportBroadcastByNodeAction(String actionName, ClusterService clusterService, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<Request> request, Executor executor) TransportBroadcastByNodeAction(String actionName, ClusterService clusterService, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<Request> request, Executor executor, boolean canTripCircuitBreaker) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ClusterBlockExceptioncheckGlobalBlock(ClusterState state, Request request) Executes a global block check before polling the cluster state.protected abstract ClusterBlockExceptioncheckRequestBlock(ClusterState state, Request request, String[] concreteIndices) Executes a global request-level check before polling the cluster state.protected voiddoExecute(Task task, Request request, ActionListener<Response> listener) protected abstract TransportBroadcastByNodeAction.ResponseFactory<Response, ShardOperationResult> getResponseFactory(Request request, ClusterState clusterState) Create a response factory based on the requst and the cluster state captured at the time the request was handled.protected abstract RequestDeserialize a request from an input streamprotected abstract ShardOperationResultDeserialize a shard-level result from an input streamprotected String[]resolveConcreteIndexNames(ClusterState clusterState, Request request) Resolves a list of concrete index names.protected abstract voidshardOperation(Request request, ShardRouting shardRouting, Task task, ActionListener<ShardOperationResult> listener) Executes the shard-level operation.protected abstract ShardsIteratorshards(ClusterState clusterState, Request request, String[] concreteIndices) Determines the shards on which this operation will be executed on.Methods inherited from class org.elasticsearch.action.support.TransportAction
execute, executeDirect, localOnly
-
Field Details
-
clusterService
-
transportService
-
indexNameExpressionResolver
-
-
Constructor Details
-
TransportBroadcastByNodeAction
public TransportBroadcastByNodeAction(String actionName, ClusterService clusterService, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<Request> request, Executor executor) -
TransportBroadcastByNodeAction
public TransportBroadcastByNodeAction(String actionName, ClusterService clusterService, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<Request> request, Executor 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:
IOException
-
getResponseFactory
protected abstract TransportBroadcastByNodeAction.ResponseFactory<Response,ShardOperationResult> getResponseFactory(Request request, ClusterState clusterState) Create a response factory based on the requst and the cluster state captured at the time the request was handled. Implementations must avoid capturing the full cluster state if possible. -
readRequestFrom
Deserialize a request from an input stream- Parameters:
in- input stream- Returns:
- a de-serialized request
- Throws:
IOException
-
shardOperation
protected abstract void shardOperation(Request request, ShardRouting shardRouting, Task task, ActionListener<ShardOperationResult> listener) Executes the shard-level operation. This method is called once per shard serially on the receiving node. This method should not throw an exception, but pass the exception to the listener instead.- Parameters:
request- the node-level requestshardRouting- the shard on which to execute the operationtask- the task for this node-level requestlistener- the listener to notify with the result of the shard-level operation
-
shards
protected abstract ShardsIterator shards(ClusterState clusterState, Request request, 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, 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:
doExecutein classTransportAction<Request extends BroadcastRequest<Request>,Response extends BaseBroadcastResponse>
-