Skip to content

Commit 089bc4b

Browse files
author
mchimang
committed
feat: add fields - raftAppliedIndex , errorsList, dbSizeInUse and isLearner in StatusResponse
Signed-off-by: mchimang <[email protected]>
1 parent 03a3b99 commit 089bc4b

File tree

4 files changed

+63
-0
lines changed

4 files changed

+63
-0
lines changed

jetcd-core/src/main/java/io/etcd/jetcd/maintenance/StatusResponse.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package io.etcd.jetcd.maintenance;
1818

19+
import java.util.List;
20+
1921
import io.etcd.jetcd.Maintenance;
2022
import io.etcd.jetcd.impl.AbstractResponse;
2123

@@ -73,4 +75,40 @@ public long getRaftIndex() {
7375
public long getRaftTerm() {
7476
return getResponse().getRaftTerm();
7577
}
78+
79+
/**
80+
* Returns the current raft applied index of the responding member.
81+
*
82+
* @return the raft applied index.
83+
*/
84+
public long getRaftAppliedIndex() {
85+
return getResponse().getRaftAppliedIndex();
86+
}
87+
88+
/**
89+
* Return the information corresponding to the alarms, health and status.
90+
*
91+
* @return the list of errors
92+
*/
93+
public List<String> getErrorList() {
94+
return getResponse().getErrorsList();
95+
}
96+
97+
/**
98+
* Returns the size of the backend database logically in use, in bytes, of the responding member.
99+
*
100+
* @return dbSizeInUse
101+
*/
102+
public long getDbSizeInUse() {
103+
return getResponse().getDbSizeInUse();
104+
}
105+
106+
/**
107+
* Returns if the member is a raft learner.
108+
*
109+
* @return if the member is a raft learner
110+
*/
111+
public boolean getIsLearner() {
112+
return getResponse().getIsLearner();
113+
}
76114
}

jetcd-core/src/main/proto/rpc.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,14 @@ message StatusResponse {
725725
uint64 raftIndex = 5;
726726
// raftTerm is the current raft term of the responding member.
727727
uint64 raftTerm = 6;
728+
// raftAppliedIndex is the current raft applied index of the responding member.
729+
uint64 raftAppliedIndex = 7;
730+
// errors contains alarm/health information and status.
731+
repeated string errors = 8;
732+
// dbSizeInUse is the size of the backend database logically in use, in bytes, of the responding member.
733+
int64 dbSizeInUse = 9;
734+
// isLearner indicates if the member is raft learner.
735+
bool isLearner = 10;
728736
}
729737

730738
message AuthEnableRequest {

jetcd-core/src/test/java/io/etcd/jetcd/impl/MaintenanceTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ public void setUp() {
7272
public void testStatusMember() throws ExecutionException, InterruptedException {
7373
StatusResponse statusResponse = maintenance.statusMember(endpoints.get(0)).get();
7474
assertThat(statusResponse.getDbSize()).isGreaterThan(0);
75+
assertThat(statusResponse.getRaftIndex()).isGreaterThan(0);
76+
assertThat(statusResponse.getRaftAppliedIndex())
77+
.isGreaterThan(0)
78+
.isLessThanOrEqualTo(statusResponse.getRaftIndex());
79+
assertThat(statusResponse.getDbSizeInUse())
80+
.isGreaterThan(0)
81+
.isLessThanOrEqualTo(statusResponse.getDbSize());
82+
assertThat(statusResponse.getIsLearner()).isFalse();
83+
assertThat(statusResponse.getErrorList().size()).isEqualTo(0);
7584
}
7685

7786
@Test

jetcd-grpc/src/main/proto/rpc.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,14 @@ message StatusResponse {
725725
uint64 raftIndex = 5;
726726
// raftTerm is the current raft term of the responding member.
727727
uint64 raftTerm = 6;
728+
// raftAppliedIndex is the current raft applied index of the responding member.
729+
uint64 raftAppliedIndex = 7;
730+
// errors contains alarm/health information and status.
731+
repeated string errors = 8;
732+
// dbSizeInUse is the size of the backend database logically in use, in bytes, of the responding member.
733+
int64 dbSizeInUse = 9;
734+
// isLearner indicates if the member is raft learner.
735+
bool isLearner = 10;
728736
}
729737

730738
message AuthEnableRequest {

0 commit comments

Comments
 (0)