Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package io.etcd.jetcd.maintenance;

import java.util.List;

import io.etcd.jetcd.Maintenance;
import io.etcd.jetcd.impl.AbstractResponse;

Expand Down Expand Up @@ -73,4 +75,40 @@ public long getRaftIndex() {
public long getRaftTerm() {
return getResponse().getRaftTerm();
}

/**
* Returns the current raft applied index of the responding member.
*
* @return the raft applied index.
*/
public long getRaftAppliedIndex() {
return getResponse().getRaftAppliedIndex();
}

/**
* Return the information corresponding to the alarms, health and status.
*
* @return the list of errors
*/
public List<String> getErrorList() {
return getResponse().getErrorsList();
}

/**
* Returns the size of the backend database logically in use, in bytes, of the responding member.
*
* @return dbSizeInUse
*/
public long getDbSizeInUse() {
return getResponse().getDbSizeInUse();
}

/**
* Returns if the member is a raft learner.
*
* @return if the member is a raft learner
*/
public boolean isLearner() {
return getResponse().getIsLearner();
}
}
8 changes: 8 additions & 0 deletions jetcd-core/src/main/proto/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,14 @@ message StatusResponse {
uint64 raftIndex = 5;
// raftTerm is the current raft term of the responding member.
uint64 raftTerm = 6;
// raftAppliedIndex is the current raft applied index of the responding member.
uint64 raftAppliedIndex = 7;
// errors contains alarm/health information and status.
repeated string errors = 8;
// dbSizeInUse is the size of the backend database logically in use, in bytes, of the responding member.
int64 dbSizeInUse = 9;
// isLearner indicates if the member is raft learner.
bool isLearner = 10;
}

message AuthEnableRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ public void setUp() {
public void testStatusMember() throws ExecutionException, InterruptedException {
StatusResponse statusResponse = maintenance.statusMember(endpoints.get(0)).get();
assertThat(statusResponse.getDbSize()).isGreaterThan(0);
assertThat(statusResponse.getRaftIndex()).isGreaterThan(0);
assertThat(statusResponse.getRaftAppliedIndex())
.isGreaterThan(0)
.isLessThanOrEqualTo(statusResponse.getRaftIndex());
assertThat(statusResponse.getDbSizeInUse())
.isGreaterThan(0)
.isLessThanOrEqualTo(statusResponse.getDbSize());
assertThat(statusResponse.isLearner()).isFalse();
assertThat(statusResponse.getErrorList().size()).isEqualTo(0);
}

@Test
Expand Down
8 changes: 8 additions & 0 deletions jetcd-grpc/src/main/proto/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,14 @@ message StatusResponse {
uint64 raftIndex = 5;
// raftTerm is the current raft term of the responding member.
uint64 raftTerm = 6;
// raftAppliedIndex is the current raft applied index of the responding member.
uint64 raftAppliedIndex = 7;
// errors contains alarm/health information and status.
repeated string errors = 8;
// dbSizeInUse is the size of the backend database logically in use, in bytes, of the responding member.
int64 dbSizeInUse = 9;
// isLearner indicates if the member is raft learner.
bool isLearner = 10;
}

message AuthEnableRequest {
Expand Down