Adding a Status.Peers endpoint to get peerset

This commit is contained in:
Armon Dadgar 2013-12-23 11:39:29 -08:00
parent 5e7e23dc52
commit 3fe3f8815d
2 changed files with 16 additions and 0 deletions

View File

@ -24,6 +24,7 @@ from the Consul service. It exposes the following methods:
* Ping : Used to test connectivity
* Leader : Used to get the address of the leader
* Peers: Used to get the Raft peerset
## Catalog Service

View File

@ -20,3 +20,18 @@ func (s *Status) Leader(args struct{}, reply *string) error {
}
return nil
}
// Peers is used to get all the Raft peers
func (s *Status) Peers(args struct{}, reply *[]string) error {
peers, err := s.server.raftPeers.Peers()
if err != nil {
return err
}
var peerStrings []string
for _, p := range peers {
peerStrings = append(peerStrings, p.String())
}
*reply = peerStrings
return nil
}