1
1
package jota .dto .response ;
2
2
3
3
/**
4
- * Response of {@link jota.dto.request.IotaNeighborsRequest}.
5
- **/
4
+ *
5
+ * Contains information about the result of a successful {@code getNodeInfo} API call.
6
+ *
7
+ */
6
8
public class GetNodeInfoResponse extends AbstractResponse {
7
9
10
+ /**
11
+ * Name of the IOTA software you're currently using. (IRI stands for IOTA Reference Implementation)
12
+ */
8
13
private String appName ;
14
+
15
+ /**
16
+ * The version of the IOTA software this node is running.
17
+ */
9
18
private String appVersion ;
10
- private String jreVersion ;
19
+
20
+ /**
21
+ * Available cores for JRE on this node.
22
+ */
11
23
private int jreAvailableProcessors ;
24
+
25
+ /**
26
+ * The amount of free memory in the Java Virtual Machine.
27
+ */
12
28
private long jreFreeMemory ;
29
+
30
+ /**
31
+ * The JRE version this node runs on
32
+ */
33
+ private String jreVersion ;
34
+
35
+ /**
36
+ * The maximum amount of memory that the Java virtual machine will attempt to use.
37
+ */
13
38
private long jreMaxMemory ;
39
+
40
+ /**
41
+ * The total amount of memory in the Java virtual machine.
42
+ */
14
43
private long jreTotalMemory ;
44
+
45
+ /**
46
+ * The hash of the latest transaction that was signed off by the coordinator.
47
+ */
15
48
private String latestMilestone ;
49
+
50
+ /**
51
+ * Index of the {@link #latestMilestone}
52
+ */
16
53
private int latestMilestoneIndex ;
54
+
55
+ /**
56
+ * The hash of the latest transaction which is solid and is used for sending transactions.
57
+ * For a milestone to become solid, your local node must approve the subtangle of coordinator-approved transactions,
58
+ * and have a consistent view of all referenced transactions.
59
+ */
17
60
private String latestSolidSubtangleMilestone ;
61
+
62
+ /**
63
+ * Index of the {@link #latestSolidSubtangleMilestone}
64
+ */
18
65
private int latestSolidSubtangleMilestoneIndex ;
66
+
67
+ /**
68
+ * The start index of the milestones.
69
+ * This index is encoded in each milestone transaction by the coordinator
70
+ */
71
+ private int milestoneStartIndex ;
72
+
73
+ /**
74
+ * Number of neighbors this node is directly connected with.
75
+ */
19
76
private int neighbors ;
77
+
78
+ /**
79
+ * The amount of transaction packets which are currently waiting to be broadcast.
80
+ */
20
81
private int packetsQueueSize ;
82
+
83
+ /**
84
+ * The difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC
85
+ */
21
86
private long time ;
87
+
88
+ /**
89
+ * Number of tips in the network.
90
+ */
22
91
private int tips ;
92
+
93
+ /**
94
+ * When a node receives a transaction from one of its neighbors,
95
+ * this transaction is referencing two other transactions t1 and t2 (trunk and branch transaction).
96
+ * If either t1 or t2 (or both) is not in the node's local database,
97
+ * then the transaction hash of t1 (or t2 or both) is added to the queue of the "transactions to request".
98
+ * At some point, the node will process this queue and ask for details about transactions in the
99
+ * "transaction to request" queue from one of its neighbors.
100
+ * This number represents the amount of "transaction to request"
101
+ */
23
102
private int transactionsToRequest ;
24
103
104
+ /**
105
+ * Every node can have features enabled or disabled.
106
+ * This list will contain all the names of the features of a node as specified in {@link Feature}.
107
+ */
25
108
private String [] features ;
109
+
110
+ /**
111
+ * The address of the Coordinator being followed by this node.
112
+ */
113
+ private String coordinatorAddress ;
26
114
27
115
/**
28
- * The name of the IOTA software the node currently running (IRI stands for Initial Reference Implementation).
29
- *
30
- * @return appName
116
+ * Creates a new {@link GetNodeInfoResponse}
117
+ *
118
+ * @param appName {@link #appName}
119
+ * @param appVersion {@link #appVersion}
120
+ * @param jreAvailableProcessors {@link #jreAvailableProcessors}
121
+ * @param jreFreeMemory {@link #jreFreeMemory}
122
+ * @param jreVersion {@link #jreVersion}
123
+ * @param maxMemory {@link #jreMaxMemory}
124
+ * @param totalMemory {@link #jreTotalMemory}
125
+ * @param latestMilestone {@link #latestMilestone}
126
+ * @param latestMilestoneIndex {@link #latestMilestoneIndex}
127
+ * @param latestSolidSubtangleMilestone {@link #latestSolidSubtangleMilestone}
128
+ * @param latestSolidSubtangleMilestoneIndex {@link #latestSolidSubtangleMilestoneIndex}
129
+ * @param milestoneStartIndex {@link #milestoneStartIndex}
130
+ * @param neighbors {@link #neighbors}
131
+ * @param packetsQueueSize {@link #packetsQueueSize}
132
+ * @param currentTimeMillis {@link #time}
133
+ * @param tips {@link #tips}
134
+ * @param numberOfTransactionsToRequest {@link #transactionsToRequest}
135
+ * @param features {@link #features}
136
+ * @param coordinatorAddress {@link #coordinatorAddress}
137
+ * @return a {@link GetNodeInfoResponse} filled with all the provided parameters
31
138
*/
32
- public String getAppName () {
33
- return appName ;
139
+ public static AbstractResponse create (String appName , String appVersion , int jreAvailableProcessors , long jreFreeMemory ,
140
+ String jreVersion , long maxMemory , long totalMemory , String latestMilestone , int latestMilestoneIndex ,
141
+ String latestSolidSubtangleMilestone , int latestSolidSubtangleMilestoneIndex , int milestoneStartIndex ,
142
+ int neighbors , int packetsQueueSize , long currentTimeMillis , int tips ,
143
+ int numberOfTransactionsToRequest , String [] features , String coordinatorAddress ) {
144
+ final GetNodeInfoResponse res = new GetNodeInfoResponse ();
145
+ res .appName = appName ;
146
+ res .appVersion = appVersion ;
147
+ res .jreAvailableProcessors = jreAvailableProcessors ;
148
+ res .jreFreeMemory = jreFreeMemory ;
149
+ res .jreVersion = jreVersion ;
150
+
151
+ res .jreMaxMemory = maxMemory ;
152
+ res .jreTotalMemory = totalMemory ;
153
+ res .latestMilestone = latestMilestone ;
154
+ res .latestMilestoneIndex = latestMilestoneIndex ;
155
+
156
+ res .latestSolidSubtangleMilestone = latestSolidSubtangleMilestone ;
157
+ res .latestSolidSubtangleMilestoneIndex = latestSolidSubtangleMilestoneIndex ;
158
+
159
+ res .milestoneStartIndex = milestoneStartIndex ;
160
+
161
+ res .neighbors = neighbors ;
162
+ res .packetsQueueSize = packetsQueueSize ;
163
+ res .time = currentTimeMillis ;
164
+ res .tips = tips ;
165
+ res .transactionsToRequest = numberOfTransactionsToRequest ;
166
+
167
+ res .features = features ;
168
+ res .coordinatorAddress = coordinatorAddress ;
169
+ return res ;
34
170
}
35
171
36
172
/**
37
- * The version of the IOTA software the node currently running.
38
- *
39
- * @return The version of the IOTA software the node currently running.
173
+ *
174
+ * @return {@link #appName}
40
175
*/
41
- public String getAppVersion () {
42
- return appVersion ;
176
+ public String getAppName () {
177
+ return appName ;
43
178
}
44
-
179
+
45
180
/**
46
- * The version of running java version.
47
- *
48
- * @return The version of running java version.
181
+ *
182
+ * @return {@link #appVersion}
49
183
*/
50
- public String getJreVersion () {
51
- return jreVersion ;
184
+ public String getAppVersion () {
185
+ return appVersion ;
52
186
}
53
187
54
188
/**
55
- * Available cores on the node currently running.
56
189
*
57
- * @return Available cores on the machine for JRE.
190
+ * @return {@link #jreAvailableProcessors}
58
191
*/
59
- public Integer getJreAvailableProcessors () {
192
+ public int getJreAvailableProcessors () {
60
193
return jreAvailableProcessors ;
61
194
}
62
195
63
196
/**
64
- * The amount of free memory in the Java Virtual Machine.
65
- *
66
- * @return The amount of free memory in the Java Virtual Machine.
197
+ *
198
+ * @return {@link #jreFreeMemory}
67
199
*/
68
200
public long getJreFreeMemory () {
69
201
return jreFreeMemory ;
70
202
}
71
203
72
204
/**
73
- * The maximum amount of memory that the Java virtual machine will attempt to use.
74
205
*
75
- * @return The maximum amount of memory that the Java virtual machine will attempt to use.
206
+ * @return {@link #jreMaxMemory}
76
207
*/
77
208
public long getJreMaxMemory () {
78
209
return jreMaxMemory ;
79
210
}
80
211
81
212
/**
82
- * The total amount of memory in the Java virtual machine.
83
213
*
84
- * @return The total amount of memory in the Java virtual machine.
214
+ * @return {@link #jreTotalMemory}
85
215
*/
86
216
public long getJreTotalMemory () {
87
217
return jreTotalMemory ;
88
218
}
89
219
90
220
/**
91
- * Latest milestone that was signed off by the coordinator.
92
221
*
93
- * @return Latest milestone that was signed off by the coordinator.
222
+ * @return {@link #jreVersion}
223
+ */
224
+ public String getJreVersion () {
225
+ return jreVersion ;
226
+ }
227
+
228
+ /**
229
+ *
230
+ * @return {@link #latestMilestone}
94
231
*/
95
232
public String getLatestMilestone () {
96
233
return latestMilestone ;
97
234
}
98
235
99
236
/**
100
- * Index of the latest milestone.
101
- *
102
- * @return Index of the latest milestone.
237
+ *
238
+ * @return {@link #latestMilestoneIndex}
103
239
*/
104
240
public int getLatestMilestoneIndex () {
105
241
return latestMilestoneIndex ;
106
242
}
107
243
108
244
/**
109
- * The latest milestone which is solid and is used for sending transactions.
110
- * For a milestone to become solid the local node must basically approve the subtangle of coordinator-approved transactions,
111
- * and have a consistent view of all referenced transactions.
112
- *
113
- * @return The latest milestone which is solid and is used for sending transactions.
245
+ *
246
+ * @return {@link #latestSolidSubtangleMilestone}
114
247
*/
115
248
public String getLatestSolidSubtangleMilestone () {
116
249
return latestSolidSubtangleMilestone ;
117
250
}
118
251
119
252
/**
120
- * Index of the latest solid subtangle.
121
- *
122
- * @return Index of the latest solid subtangle.
253
+ *
254
+ * @return {@link #latestSolidSubtangleMilestoneIndex}
123
255
*/
124
256
public int getLatestSolidSubtangleMilestoneIndex () {
125
257
return latestSolidSubtangleMilestoneIndex ;
126
258
}
127
259
128
260
/**
129
- * Number of neighbors the node connected with.
130
261
*
131
- * @return Number of neighbors the node connected with.
262
+ * @return {@link #milestoneStartIndex}
263
+ */
264
+ public int getMilestoneStartIndex () {
265
+ return milestoneStartIndex ;
266
+ }
267
+
268
+ /**
269
+ *
270
+ * @return {@link #neighbors}
132
271
*/
133
272
public int getNeighbors () {
134
273
return neighbors ;
135
274
}
136
275
137
276
/**
138
- * Packets which are currently queued up.
139
277
*
140
- * @return Packets which are currently queued up.
278
+ * @return {@link #packetsQueueSize}
141
279
*/
142
280
public int getPacketsQueueSize () {
143
281
return packetsQueueSize ;
144
282
}
145
283
146
284
/**
147
- * Current UNIX timestamp.
148
285
*
149
- * @return Current UNIX timestamp.
286
+ * @return {@link #time}
150
287
*/
151
- public Long getTime () {
288
+ public long getTime () {
152
289
return time ;
153
290
}
154
291
155
292
/**
156
- * Number of tips in the network.
157
293
*
158
- * @return Number of tips in the network.
294
+ * @return {@link # tips}
159
295
*/
160
296
public int getTips () {
161
297
return tips ;
162
298
}
163
299
164
300
/**
165
- * Transactions to request during syncing process.
166
301
*
167
- * @return Transactions to request during syncing process.
302
+ * @return {@link #transactionsToRequest}
168
303
*/
169
304
public int getTransactionsToRequest () {
170
305
return transactionsToRequest ;
171
306
}
172
307
173
308
/**
174
309
*
175
- * @return
310
+ * @return {@link #features}
176
311
*/
177
312
public String [] getFeatures () {
178
313
return features ;
179
314
}
180
- }
315
+
316
+ /**
317
+ *
318
+ * @return {@link #coordinatorAddress}
319
+ */
320
+ public String getCoordinatorAddress () {
321
+ return coordinatorAddress ;
322
+ }
323
+ }
0 commit comments