Documentation ¶
Index ¶
- type CommListener
- type Node
- func (self *Node) AddChangeListener(f common.RingChangeListener)
- func (self *Node) AddCommListener(f CommListener)
- func (self *Node) CountNodes() int
- func (self *Node) Describe() string
- func (self *Node) Export(name string, api interface{}) error
- func (self *Node) GetBroadcastAddr() string
- func (self *Node) GetListenAddr() string
- func (self *Node) GetNodes() (result common.Remotes)
- func (self *Node) GetPosition() (result []byte)
- func (self *Node) GetPredecessor() common.Remote
- func (self *Node) GetPredecessorFor(key []byte) common.Remote
- func (self *Node) GetPredecessorForRemote(r common.Remote) common.Remote
- func (self *Node) GetSuccessor() common.Remote
- func (self *Node) GetSuccessorFor(key []byte) common.Remote
- func (self *Node) GetSuccessorForRemote(r common.Remote) common.Remote
- func (self *Node) HasNode(pos []byte) bool
- func (self *Node) Join(addr string) (err error)
- func (self *Node) MustJoin(addr string)
- func (self *Node) MustStart()
- func (self *Node) Nodes() common.Remotes
- func (self *Node) Notify(caller common.Remote) common.Remote
- func (self *Node) Ping(ping PingPack) (me common.Remote)
- func (self *Node) Redundancy() int
- func (self *Node) Remote() common.Remote
- func (self *Node) RemoveNode(remote common.Remote)
- func (self *Node) RingHash() []byte
- func (self *Node) SetPosition(position []byte) *Node
- func (self *Node) Start() (err error)
- func (self *Node) Stop()
- func (self *Node) String() string
- type PingPack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommListener ¶
CommListener is a function listening for generic communication between two Nodes.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is a node in a chord like cluster.
Like chord networks, it is a ring of nodes ordered by a position metric. Unlike chord, every node has every other node in its routing table. This allows stable networks to route with a constant time complexity.
func (*Node) AddChangeListener ¶
func (self *Node) AddChangeListener(f common.RingChangeListener)
func (*Node) AddCommListener ¶
func (self *Node) AddCommListener(f CommListener)
func (*Node) CountNodes ¶
CountNodes returns the number of Nodes in the ring.
func (*Node) Describe ¶
Describe returns a humanly readable string describing the broadcast address, position and ring of this Node.
func (*Node) GetBroadcastAddr ¶
func (*Node) GetListenAddr ¶
func (*Node) GetPosition ¶
func (*Node) GetPredecessor ¶
GetPredecessor will return our predecessor on the ring.
func (*Node) GetPredecessorFor ¶
GetPredecessorFor will return the predecessor for the provided key.
func (*Node) GetPredecessorForRemote ¶
GetPredecessorForRemote will return the predecessor for the provided remote.
func (*Node) GetSuccessor ¶
GetSuccessor will return our successor on the ring.
func (*Node) GetSuccessorFor ¶
GetSuccessorFor will return the successor for the provided key. If the successor is not this Node, it will assert that the provided key is between the found successor and the predecessor it claims to have.
func (*Node) GetSuccessorForRemote ¶
GetSuccessorFor will return the successor for the provided remote.
func (*Node) Join ¶
Join will fetch the routing ring of the Node at addr, pick a location on an empty spot in the received ring and notify the other Node of our joining.
func (*Node) Ping ¶
Ping will compare the hash of this Node with the one in the received PingPack, and request the entire routing ring from the sender if they are not equal.
func (*Node) Redundancy ¶
Redundancy will return the current maximum redundancy in the ring.
func (*Node) RemoveNode ¶
RemoveNode will remove the provided remote from our routing ring.