diff --git a/agent/agent.go b/agent/agent.go index 652143ec54..7374c52433 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -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 diff --git a/agent/consul/client.go b/agent/consul/client.go index d669100ff7..00f339d6d4 100644 --- a/agent/consul/client.go +++ b/agent/consul/client.go @@ -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) { diff --git a/agent/consul/server.go b/agent/consul/server.go index 06f843417e..afcebd60df 100644 --- a/agent/consul/server.go +++ b/agent/consul/server.go @@ -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) diff --git a/agent/router/manager.go b/agent/router/manager.go index 19c710e9f7..288a30bd0a 100644 --- a/agent/router/manager.go +++ b/agent/router/manager.go @@ -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) { diff --git a/agent/router/router.go b/agent/router/router.go index 3299b781cd..c41a6a79ce 100644 --- a/agent/router/router.go +++ b/agent/router/router.go @@ -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 -}