-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathLocalNodeResponse.java
More file actions
60 lines (49 loc) · 1.57 KB
/
LocalNodeResponse.java
File metadata and controls
60 lines (49 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
package org.opensearch.cluster;
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.transport.TransportResponse;
import java.io.IOException;
import java.util.Objects;
/**
* LocalNode Response for Extensibility
*
* @opensearch.internal
*/
public class LocalNodeResponse extends TransportResponse {
private final DiscoveryNode localNode;
public LocalNodeResponse(ClusterService clusterService) {
this.localNode = clusterService.localNode();
}
public LocalNodeResponse(StreamInput in) throws IOException {
super(in);
this.localNode = new DiscoveryNode(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
this.localNode.writeTo(out);
}
@Override
public String toString() {
return "LocalNodeResponse{" + "localNode=" + localNode + '}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LocalNodeResponse that = (LocalNodeResponse) o;
return Objects.equals(localNode, that.localNode);
}
@Override
public int hashCode() {
return Objects.hash(localNode);
}
}