@@ -34,11 +34,12 @@ public class Instance {
34
34
private String namespace ;
35
35
private String clusterName ;
36
36
private String unit ;
37
- private Node .Endpoint controlEndpoint = new Node .Endpoint ();
38
- private Node .Endpoint transactionEndpoint = new Node .Endpoint ();
37
+ private Node .Endpoint control = new Node .Endpoint ();
38
+ private Node .Endpoint transaction = new Node .Endpoint ();
39
39
private double weight = 1.0 ;
40
40
private boolean healthy = true ;
41
41
private long term ;
42
+ private long timestamp ;
42
43
private ClusterRole role = ClusterRole .MEMBER ;
43
44
private Map <String , Object > metadata = new HashMap <>();
44
45
@@ -83,20 +84,20 @@ public void setRole(ClusterRole role) {
83
84
this .role = role ;
84
85
}
85
86
86
- public Node .Endpoint getControlEndpoint () {
87
- return controlEndpoint ;
87
+ public Node .Endpoint getControl () {
88
+ return control ;
88
89
}
89
90
90
- public void setControlEndpoint (Node .Endpoint controlEndpoint ) {
91
- this .controlEndpoint = controlEndpoint ;
91
+ public void setControl (Node .Endpoint control ) {
92
+ this .control = control ;
92
93
}
93
94
94
- public Node .Endpoint getTransactionEndpoint () {
95
- return transactionEndpoint ;
95
+ public Node .Endpoint getTransaction () {
96
+ return transaction ;
96
97
}
97
98
98
- public void setTransactionEndpoint (Node .Endpoint transactionEndpoint ) {
99
- this .transactionEndpoint = transactionEndpoint ;
99
+ public void setTransaction (Node .Endpoint transaction ) {
100
+ this .transaction = transaction ;
100
101
}
101
102
102
103
public double getWeight () {
@@ -124,6 +125,14 @@ public void setTerm(long term) {
124
125
this .term = term ;
125
126
}
126
127
128
+ public long getTimestamp () {
129
+ return timestamp ;
130
+ }
131
+
132
+ public void setTimestamp (long timestamp ) {
133
+ this .timestamp = timestamp ;
134
+ }
135
+
127
136
public void addMetadata (String key , Object value ) {
128
137
this .metadata .put (key , value );
129
138
}
@@ -134,7 +143,7 @@ public void setMetadata(Map<String, Object> metadata) {
134
143
135
144
@ Override
136
145
public int hashCode () {
137
- return Objects .hash (controlEndpoint , transactionEndpoint );
146
+ return Objects .hash (control , transaction );
138
147
}
139
148
140
149
@ Override
@@ -146,7 +155,7 @@ public boolean equals(Object o) {
146
155
return false ;
147
156
}
148
157
Instance instance = (Instance ) o ;
149
- return Objects .equals (controlEndpoint , instance .controlEndpoint ) && Objects .equals (transactionEndpoint , instance .transactionEndpoint );
158
+ return Objects .equals (control , instance .control ) && Objects .equals (transaction , instance .transaction );
150
159
}
151
160
152
161
@@ -168,11 +177,12 @@ public Map<String, String> toMap() {
168
177
resultMap .put ("namespace" , namespace );
169
178
resultMap .put ("clusterName" , clusterName );
170
179
resultMap .put ("unit" , unit );
171
- resultMap .put ("controlEndpoint " , controlEndpoint .toString ());
172
- resultMap .put ("transactionEndpoint " , transactionEndpoint .toString ());
180
+ resultMap .put ("control " , control .toString ());
181
+ resultMap .put ("transaction " , transaction .toString ());
173
182
resultMap .put ("weight" , String .valueOf (weight ));
174
183
resultMap .put ("healthy" , String .valueOf (healthy ));
175
184
resultMap .put ("term" , String .valueOf (term ));
185
+ resultMap .put ("timestamp" ,String .valueOf (timestamp ));
176
186
resultMap .put ("metadata" , mapToJsonString (metadata ));
177
187
178
188
return resultMap ;
0 commit comments