ruojieranyishen commented on code in PR #2162:
URL:
https://github.com/apache/incubator-pegasus/pull/2162#discussion_r1872510306
##########
admin-cli/executor/client.go:
##########
@@ -67,3 +69,46 @@ func NewClient(writer io.Writer, metaAddrs []string) *Client
{
Perf: aggregate.NewPerfClient(metaAddrs),
}
}
+
+// NewClientWithoutExit creates a client for accessing Pegasus cluster for use
of admin-cli.
+// This function will not call os.Exit.
+func NewClientWithoutExit(writer io.Writer, metaAddrs []string) (*Client,
error) {
+ meta := client.NewRPCBasedMeta(metaAddrs)
+
+ nodes, err := meta.ListNodes()
+ if err != nil {
+ fmt.Fprintf(writer, "fatal: failed to list nodes [%s]\n", err)
+ return nil, fmt.Errorf("fatal: failed to list nodes [%s]", err)
+ }
+
+ var replicaAddrs []string
+ for _, node := range nodes {
+ replicaAddrs = append(replicaAddrs, node.Address.GetAddress())
+ }
+
+ return &Client{
+ Writer: writer,
+ Meta: meta,
+ Nodes: util.NewPegasusNodeManager(metaAddrs, replicaAddrs),
+ Perf: aggregate.NewPerfClient(metaAddrs),
+ }, nil
+}
+
+func CloseClient(writer io.Writer, client *Client) error {
Review Comment:
The context is that I am estimating the required disk space for a bulk load
on the Pegasus gateway using admincli, but currently, admincli does not support
disconnect tcp from the replica server.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]