szetszwo commented on PR #658:
URL: https://github.com/apache/ratis/pull/658#issuecomment-1161207536
Below are some rough ideas. Forgot to post it previously.
```
diff --git
a/ratis-client/src/main/java/org/apache/ratis/client/api/AdminApi.java
b/ratis-client/src/main/java/org/apache/ratis/client/api/AdminApi.java
index c9c3f7b4..fc11c9b0 100644
--- a/ratis-client/src/main/java/org/apache/ratis/client/api/AdminApi.java
+++ b/ratis-client/src/main/java/org/apache/ratis/client/api/AdminApi.java
@@ -32,6 +32,22 @@ import java.util.List;
* such as setting raft configuration and transferring leadership.
*/
public interface AdminApi {
+ class SetConfigurationArguments {
+ // TODO add details
+
+ public static Builder newBuilder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+ // TODO add details
+
+ public SetConfigurationArguments build() {
+ return null;
+ }
+ }
+ }
+
/** The same as setConfiguration(serversInNewConf,
Collections.emptyList()). */
default RaftClientReply setConfiguration(List<RaftPeer> serversInNewConf)
throws IOException {
return setConfiguration(serversInNewConf, Collections.emptyList());
@@ -42,15 +58,15 @@ public interface AdminApi {
return setConfiguration(Arrays.asList(serversInNewConf));
}
- RaftClientReply setConfiguration(List<RaftPeer> serversInNewConf,
SetConfigurationRequest.Mode mode)
- throws IOException;
-
/** Set the configuration request to the raft service. */
- RaftClientReply setConfiguration(List<RaftPeer> serversInNewConf,
List<RaftPeer> listenersInNewConf)
- throws IOException;
+ default RaftClientReply setConfiguration(List<RaftPeer> serversInNewConf,
List<RaftPeer> listenersInNewConf)
+ throws IOException {
+ // TODO use Builder
+ return setConfiguration(SetConfigurationArguments.newBuilder().build());
+ }
- RaftClientReply setConfiguration(List<RaftPeer> serversInNewConf,
List<RaftPeer> listenersInNewConf,
- SetConfigurationRequest.Mode mode) throws IOException;
+ RaftClientReply setConfiguration(SetConfigurationArguments arguments)
+ throws IOException;
/** The same as setConfiguration(Arrays.asList(serversInNewConf),
Arrays.asList(listenersInNewConf)). */
default RaftClientReply setConfiguration(RaftPeer[] serversInNewConf,
RaftPeer[] listenersInNewConf)
diff --git a/ratis-proto/src/main/proto/Raft.proto
b/ratis-proto/src/main/proto/Raft.proto
index 2c149846..f6b38c14 100644
--- a/ratis-proto/src/main/proto/Raft.proto
+++ b/ratis-proto/src/main/proto/Raft.proto
@@ -406,15 +406,14 @@ message RaftClientReplyProto {
// setConfiguration request
message SetConfigurationRequestProto {
+ enum Mode {
+ SET_UNCONDITIONALLY = 0;
+ ADD = 1;
+ }
RaftRpcRequestProto rpcRequest = 1;
repeated RaftPeerProto peers = 2;
repeated RaftPeerProto listeners = 3;
- enum RaftConfigurationMode {
- NORMAL = 0;
- ADD = 1;
- }
-
- optional RaftConfigurationMode mode = 4;
+ optional Mode mode = 4;
}
// transfer leadership request
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]