Documentation ¶
Index ¶
- type Manager
- func (m *Manager) Close()
- func (m *Manager) ClusterSizeDependantInterval(baseInterval time.Duration) time.Duration
- func (m *Manager) DeleteAllNodes()
- func (m *Manager) Exists(id node.Identity) bool
- func (m *Manager) GetNodes() map[node.Identity]node.Node
- func (m *Manager) NodeDeleted(n node.Node)
- func (m *Manager) NodeSoftUpdated(n node.Node)
- func (m *Manager) NodeUpdated(n node.Node)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the entity that manages a collection of nodes
func NewManager ¶
func NewManager(name string, datapath datapath.NodeHandler) (*Manager, error)
NewManager returns a new node manager
func (*Manager) ClusterSizeDependantInterval ¶
ClusterSizeDependantInterval returns a time.Duration that is dependant on the cluster size, i.e. the number of nodes that have been discovered. This can be used to control sync intervals of shared or centralized resources to avoid overloading these resources as the cluster grows.
Example sync interval with baseInterval = 1 * time.Minute
nodes | sync interval ------+----------------- 1 | 41.588830833s 2 | 1m05.916737320s 4 | 1m36.566274746s 8 | 2m11.833474640s 16 | 2m49.992800643s 32 | 3m29.790453687s 64 | 4m10.463236193s 128 | 4m51.588744261s 256 | 5m32.944565093s 512 | 6m14.416550710s 1024 | 6m55.946873494s 2048 | 7m37.506428894s 4096 | 8m19.080616652s 8192 | 9m00.662124608s 16384 | 9m42.247293667s
func (*Manager) DeleteAllNodes ¶
func (m *Manager) DeleteAllNodes()
DeleteAllNodes deletes all nodes from the node maanger.
func (*Manager) GetNodes ¶
GetNodes returns a copy of all of the nodes as a map from Identity to Node.
func (*Manager) NodeDeleted ¶
NodeDeleted is called after a node has been deleted. It removes the node from the manager if the node is still owned by the source of which the event orgins from. If the node was removed, NodeDelete() is invoked of the datapath interface.
func (*Manager) NodeSoftUpdated ¶
NodeSoftUpdated is called after the information of a node has be upated but unlike a NodeUpdated does not require the datapath to be updated.
func (*Manager) NodeUpdated ¶
NodeUpdated is called after the information of a node has been updated. The node in the manager is added or updated if the source is allowed to update the node. If an update or addition has occured, NodeUpdate() of the datapath interface is invoked.