mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Change ByID boolean to Peer string and add Peer id in replicas output
The CLI will now be able to display the peer IDs in MetaGroupInfo if it choses to do so, and possibly help user select the peer ID from a list with a new command to remove by peer ID instead of by server name. Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
@@ -581,7 +581,9 @@ const JSApiLeaderStepDownResponseType = "io.nats.jetstream.api.v1.meta_leader_st
|
||||
type JSApiMetaServerRemoveRequest struct {
|
||||
// Server name of the peer to be removed.
|
||||
Server string `json:"peer"`
|
||||
ByID bool `json:"by_id,omitempty"`
|
||||
// Peer ID of the peer to be removed. If specified this is used
|
||||
// instead of the server name.
|
||||
Peer string `json:"peer_id,omitempty"`
|
||||
}
|
||||
|
||||
// JSApiMetaServerRemoveResponse is the response to a peer removal request in the meta group.
|
||||
@@ -2216,9 +2218,10 @@ func (s *Server) jsLeaderServerRemoveRequest(sub *subscription, c *client, _ *Ac
|
||||
var found string
|
||||
js.mu.RLock()
|
||||
for _, p := range cc.meta.Peers() {
|
||||
if req.ByID {
|
||||
if p.ID == req.Server {
|
||||
found = req.Server
|
||||
// If Peer is specified, it takes precedence
|
||||
if req.Peer != _EMPTY_ {
|
||||
if p.ID == req.Peer {
|
||||
found = req.Peer
|
||||
break
|
||||
}
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user