agent: drop unused code

This code from http://github.com/hashicorp/consul/pull/3353 is no longer
required.
pull/3401/head
Frank Schroeder 7 years ago committed by Frank Schröder
parent bf96857b17
commit 16c58da27d

@ -62,7 +62,6 @@ type delegate interface {
JoinLAN(addrs []string) (n int, err error)
RemoveFailedNode(node string) error
RPC(method string, args interface{}, reply interface{}) error
ServerAddrs() map[string]string
SnapshotRPC(args *structs.SnapshotRequest, in io.Reader, out io.Writer, replyFn structs.SnapshotReplyFn) error
Shutdown() error
Stats() map[string]map[string]string

@ -411,10 +411,6 @@ func (c *Client) Stats() map[string]map[string]string {
return stats
}
func (c *Client) ServerAddrs() map[string]string {
return c.routers.GetServerAddrs()
}
// GetLANCoordinate returns the network coordinate of the current node, as
// maintained by Serf.
func (c *Client) GetLANCoordinate() (*coordinate.Coordinate, error) {

@ -1047,15 +1047,6 @@ func (s *Server) GetWANCoordinate() (*coordinate.Coordinate, error) {
return s.serfWAN.GetCoordinate()
}
func (s *Server) ServerAddrs() map[string]string {
ret, err := s.router.FindServerAddrs(s.config.Datacenter)
if err != nil {
s.logger.Printf("[WARN] Unexpected state, no server addresses for datacenter %v, got error: %v", s.config.Datacenter, err)
return nil
}
return ret
}
// Atomically sets a readiness state flag when leadership is obtained, to indicate that server is past its barrier write
func (s *Server) setConsistentReadReady() {
atomic.StoreInt32(&s.readyForConsistentReads, 1)

@ -223,15 +223,6 @@ func (m *Manager) getServerList() serverList {
return m.listValue.Load().(serverList)
}
// GetServerAddrs returns a map from node name to address for all servers
func (m *Manager) GetServerAddrs() map[string]string {
ret := make(map[string]string)
for _, server := range m.getServerList().servers {
ret[server.Name] = server.Addr.String()
}
return ret
}
// saveServerList is a convenience method which hides the locking semantics
// of atomic.Value from the caller.
func (m *Manager) saveServerList(l serverList) {

@ -489,26 +489,3 @@ func (r *Router) GetDatacenterMaps() ([]structs.DatacenterMap, error) {
}
return maps, nil
}
func (r *Router) FindServerAddrs(datacenter string) (map[string]string, error) {
r.RLock()
defer r.RUnlock()
// Get the list of managers for this datacenter. This will usually just
// have one entry, but it's possible to have a user-defined area + WAN.
managers, ok := r.managers[datacenter]
if !ok {
return nil, fmt.Errorf("datacenter %v not found", datacenter)
}
ret := make(map[string]string)
for _, manager := range managers {
if manager.IsOffline() {
continue
}
for name, addr := range manager.GetServerAddrs() {
ret[name] = addr
}
}
return ret, nil
}

Loading…
Cancel
Save