MCPcopy Create free account
hub / github.com/crate/crate / NodeClient

Class NodeClient

server/src/main/java/org/elasticsearch/client/node/NodeClient.java:34–64  ·  view source on GitHub ↗

Client that executes actions on the local node.

Source from the content-addressed store, hash-verified

32 * Client that executes actions on the local node.
33 */
34public class NodeClient implements Client {
35
36 @SuppressWarnings("rawtypes")
37 private Map<ActionType, TransportAction> actions;
38
39 public NodeClient() {
40 }
41
42 @SuppressWarnings("rawtypes")
43 public void initialize(Map<ActionType, TransportAction> actions) {
44 this.actions = actions;
45 }
46
47 @Override
48 public void close() {
49 // nothing really to do
50 }
51
52 @Override
53 @SuppressWarnings("unchecked")
54 public <Req extends TransportRequest, Resp extends TransportResponse> CompletableFuture<Resp> execute(ActionType<Resp> action, Req request) {
55 if (actions == null) {
56 throw new IllegalStateException("NodeClient has not been initialized");
57 }
58 TransportAction<Req, Resp> transportAction = actions.get(action);
59 if (transportAction == null) {
60 throw new IllegalStateException("failed to find action [" + action + "] to execute");
61 }
62 return transportAction.execute(request);
63 }
64}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected