Documentation ¶
Overview ¶
Package servers provides an interface for choosing Servers to communicate with from a Nomad Client perspective. The package does not provide any API guarantees and should be called only by `hashicorp/nomad`.
Index ¶
- type Manager
- func (m *Manager) FindServer() *Server
- func (m *Manager) GetServers() Servers
- func (m *Manager) NotifyFailedServer(s *Server)
- func (m *Manager) NumNodes() int32
- func (m *Manager) NumServers() int
- func (m *Manager) RebalanceServers()
- func (m *Manager) ResetRebalanceTimer()
- func (m *Manager) SetNumNodes(n int32)
- func (m *Manager) SetServers(servers Servers) bool
- func (m *Manager) Start()
- type Pinger
- type Server
- type Servers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
func (*Manager) FindServer ¶
FindServer returns a server to send an RPC too. If there are no servers, nil is returned.
func (*Manager) GetServers ¶
GetServers returns a copy of the current list of servers.
func (*Manager) NotifyFailedServer ¶
NotifyFailedServer marks the passed in server as "failed" by rotating it to the end of the server list.
func (*Manager) NumServers ¶
NumServers returns the total number of known servers whether healthy or not.
func (*Manager) RebalanceServers ¶
func (m *Manager) RebalanceServers()
RebalanceServers shuffles the order in which Servers will be contacted. The function will shuffle the set of potential servers to contact and then attempt to contact each server. If a server successfully responds it is used, otherwise it is rotated such that it will be the last attempted server.
func (*Manager) ResetRebalanceTimer ¶
func (m *Manager) ResetRebalanceTimer()
ResetRebalanceTimer resets the rebalance timer. This method exists for testing and should not be used directly.
func (*Manager) SetNumNodes ¶
SetNumNodes stores the number of approximate nodes in the cluster.
func (*Manager) SetServers ¶
SetServers sets the servers and returns if the new server list is different than the existing server set
type Server ¶
type Server struct { // Addr is the resolved address of the server Addr net.Addr sync.Mutex // DC is the datacenter of the server DC string // contains filtered or unexported fields }
Server contains the address of a server and metadata that can be used for choosing a server to contact.