Repository: incubator-ratis Updated Branches: refs/heads/master 1bc5d2a82 -> 151c2aeed
RATIS-293. Add an api for RaftServer to return its current GroupId. Contributed by Mukul Kumar Singh. Project: http://git-wip-us.apache.org/repos/asf/incubator-ratis/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ratis/commit/151c2aee Tree: http://git-wip-us.apache.org/repos/asf/incubator-ratis/tree/151c2aee Diff: http://git-wip-us.apache.org/repos/asf/incubator-ratis/diff/151c2aee Branch: refs/heads/master Commit: 151c2aeed9fd9ebd7d86dc8ceacbd8580f4a9520 Parents: 1bc5d2a Author: Mukul Kumar Singh <[email protected]> Authored: Tue Aug 7 00:42:15 2018 +0530 Committer: Mukul Kumar Singh <[email protected]> Committed: Tue Aug 7 00:42:15 2018 +0530 ---------------------------------------------------------------------- .../src/main/java/org/apache/ratis/server/RaftServer.java | 3 +++ .../main/java/org/apache/ratis/server/impl/RaftServerProxy.java | 5 +++++ 2 files changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/151c2aee/ratis-server/src/main/java/org/apache/ratis/server/RaftServer.java ---------------------------------------------------------------------- diff --git a/ratis-server/src/main/java/org/apache/ratis/server/RaftServer.java b/ratis-server/src/main/java/org/apache/ratis/server/RaftServer.java index daae997..acd54cb 100644 --- a/ratis-server/src/main/java/org/apache/ratis/server/RaftServer.java +++ b/ratis-server/src/main/java/org/apache/ratis/server/RaftServer.java @@ -40,6 +40,9 @@ public interface RaftServer extends Closeable, RpcType.Get, /** @return the server ID. */ RaftPeerId getId(); + /** @return the group IDs the server is part of. */ + Iterable<RaftGroupId> getGroupIds() throws IOException; + /** @return the server properties. */ RaftProperties getProperties(); http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/151c2aee/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java ---------------------------------------------------------------------- diff --git a/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java index 92ed370..9db7735 100644 --- a/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java +++ b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java @@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.net.InetSocketAddress; +import java.util.Collections; import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; @@ -97,6 +98,10 @@ public class RaftServerProxy implements RaftServer { return id; } + public Iterable<RaftGroupId> getGroupIds() throws IOException { + return Collections.singleton(getImpl().getGroupId()); + } + @Override public RpcType getRpcType() { return getFactory().getRpcType();
