You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by dr...@apache.org on 2022/08/29 02:51:43 UTC

[ratis] 03/05: RATIS-1687. Make SetConfigurationRequest backwards compatible (#725)

This is an automated email from the ASF dual-hosted git repository.

dragonyliu pushed a commit to branch release-2.4.0
in repository https://gitbox.apache.org/repos/asf/ratis.git

commit 6767cb016cb6c88044b4cfafd9f09846ba940545
Author: Doroszlai, Attila <64...@users.noreply.github.com>
AuthorDate: Fri Aug 26 18:41:07 2022 +0200

    RATIS-1687. Make SetConfigurationRequest backwards compatible (#725)
    
    (cherry picked from commit 48da6bdca48dfe666506bc0cb8ecf8661166ce4a)
---
 .../ratis/protocol/SetConfigurationRequest.java    | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/ratis-common/src/main/java/org/apache/ratis/protocol/SetConfigurationRequest.java b/ratis-common/src/main/java/org/apache/ratis/protocol/SetConfigurationRequest.java
index e5e8236b8..4f78c2b94 100644
--- a/ratis-common/src/main/java/org/apache/ratis/protocol/SetConfigurationRequest.java
+++ b/ratis-common/src/main/java/org/apache/ratis/protocol/SetConfigurationRequest.java
@@ -148,12 +148,37 @@ public class SetConfigurationRequest extends RaftClientRequest {
   }
   private final Arguments arguments;
 
+  public SetConfigurationRequest(ClientId clientId, RaftPeerId serverId,
+      RaftGroupId groupId, long callId, List<RaftPeer> peers) {
+    this(clientId, serverId, groupId, callId,
+        Arguments.newBuilder()
+            .setServersInNewConf(peers)
+            .build());
+  }
+
+  public SetConfigurationRequest(ClientId clientId, RaftPeerId serverId,
+      RaftGroupId groupId, long callId, List<RaftPeer> peers, List<RaftPeer> listeners) {
+    this(clientId, serverId, groupId, callId,
+        Arguments.newBuilder()
+            .setServersInNewConf(peers)
+            .setListenersInNewConf(listeners)
+            .build());
+  }
+
   public SetConfigurationRequest(ClientId clientId, RaftPeerId serverId,
       RaftGroupId groupId, long callId, Arguments arguments) {
     super(clientId, serverId, groupId, callId, true, writeRequestType());
     this.arguments = arguments;
   }
 
+  public List<RaftPeer> getPeersInNewConf() {
+    return arguments.serversInNewConf;
+  }
+
+  public List<RaftPeer> getListenersInNewConf() {
+    return arguments.listenersInNewConf;
+  }
+
   public Arguments getArguments() {
     return arguments;
   }