open-consul/consul/status_endpoint.go
2013-12-10 15:16:41 -08:00

23 lines
468 B
Go

package consul
// Status endpoint is used to check on server status
type Status struct {
server *Server
}
// Ping is used to just check for connectivity
func (s *Status) Ping(args struct{}, reply *struct{}) error {
return nil
}
// Leader is used to get the address of the leader
func (s *Status) Leader(args struct{}, reply *string) error {
leader := s.server.raft.Leader()
if leader != nil {
*reply = leader.String()
} else {
*reply = ""
}
return nil
}