Documentation ¶
Index ¶
- type Node
- func (n *Node) ID() string
- func (n *Node) Join(remote netip.AddrPort) error
- func (n *Node) LocalAddr() netip.AddrPort
- func (n *Node) OnFail(f func(nodeID string))
- func (n *Node) OnJoin(f func(nodeID string, addr netip.AddrPort))
- func (n *Node) OnMemo(f func(nodeID string, addr netip.AddrPort, memo []byte))
- func (n *Node) PostMemo(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
A Node is a network node participating in the SWIM protocol.
func Start ¶
Start creates a new Node listening on the local UDP address.
If the address's host is empty or a literal unspecified IP address, the Node listens on all available IP addresses of the local system except multicast IP addresses. If the port is empty or "0", as in "127.0.0.1:" or "[::1]:0", a port number is automatically chosen.
func (*Node) Join ¶
Join connects n to a remote node. This is typically used to connect a new node to an existing network.
func (*Node) OnFail ¶
OnFail uses f as n's failure handler, to be called when a peer leaves the network. For each peer, the call to f happens after all calls to the memo handler (if any) return.
func (*Node) OnJoin ¶
OnJoin uses f as n's join handler, to be called when a peer joins the network.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
roundrobinrandom
Package roundrobinrandom implements a randomized round-based ordering type.
|
Package roundrobinrandom implements a randomized round-based ordering type. |
rpq
Package rpq implements a recurrent priority queue: a priority queue whose elements can be returned multiple times, up to a specified quota, prioritized according to how many times they have already been returned.
|
Package rpq implements a recurrent priority queue: a priority queue whose elements can be returned multiple times, up to a specified quota, prioritized according to how many times they have already been returned. |