public final class CliUtils extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
checkReply(RaftClientReply reply,
Supplier<String> message,
PrintStream printStream)
Check if the given reply is success.
|
static RaftGroupId |
getGroupId(RaftClient client,
List<RaftPeer> peers,
RaftGroupId groupId,
PrintStream err)
Get the group id from the given peers if the given group id is null.
|
static GroupInfoReply |
getGroupInfo(RaftClient client,
List<RaftPeer> peers,
RaftGroupId groupId,
PrintStream err)
Get the group info from the given peers.
|
static RaftPeerId |
getPeerId(InetSocketAddress address) |
static RaftPeerId |
getPeerId(String host,
int port) |
static InetSocketAddress |
parseInetSocketAddress(String address)
Parse the given string as a
InetSocketAddress. |
static RaftGroupId |
parseRaftGroupId(String groupId)
Parse the given string as a
RaftGroupId. |
static List<RaftPeer> |
parseRaftPeers(String peers)
Parse the given string as a list of
RaftPeer. |
public static RaftPeerId getPeerId(InetSocketAddress address)
RaftPeerId from the given address.public static RaftPeerId getPeerId(String host, int port)
RaftPeerId from the given host and port.public static List<RaftPeer> parseRaftPeers(String peers)
RaftPeer.public static RaftGroupId parseRaftGroupId(String groupId)
RaftGroupId.public static RaftGroupId getGroupId(RaftClient client, List<RaftPeer> peers, RaftGroupId groupId, PrintStream err) throws IOException
client - for communicating to the peers.peers - the peers of the group.groupId - the given group id, if there is any.err - for printing error messages.IOExceptionpublic static GroupInfoReply getGroupInfo(RaftClient client, List<RaftPeer> peers, RaftGroupId groupId, PrintStream err) throws IOException
client - for communicating to the peers.peers - the peers of the group.groupId - the target grouperr - for printing error messages.IOExceptionpublic static void checkReply(RaftClientReply reply, Supplier<String> message, PrintStream printStream) throws IOException
IOExceptionpublic static InetSocketAddress parseInetSocketAddress(String address)
InetSocketAddress.Copyright © 2017–2025 The Apache Software Foundation. All rights reserved.