Documentation ¶
Overview ¶
Package node contains node logic.
Index ¶
- type CalculateNextEpoch
- type Mode
- type Node
- func NewEphemeralNode(id state.PeerID, t transport.Transport, nextEpoch CalculateNextEpoch, ...) *Node
- func NewNode(ms store.MessageStore, st transport.Transport, ss state.SyncState, ...) *Node
- func NewPersistentNode(db *sql.DB, st transport.Transport, id state.PeerID, mode Mode, ...) (*Node, error)
- func (n *Node) AddPeer(group state.GroupID, id state.PeerID) error
- func (n *Node) AppendMessage(groupID state.GroupID, data []byte) (state.MessageID, error)
- func (n *Node) CurrentEpoch() int64
- func (n *Node) IsPeerInGroup(g state.GroupID, p state.PeerID) (bool, error)
- func (n *Node) RequestMessage(group state.GroupID, id state.MessageID) error
- func (n *Node) Start(duration time.Duration)
- func (n *Node) Stop()
- func (n *Node) Subscribe() chan protobuf.Message
- func (n *Node) Unsubscribe()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CalculateNextEpoch ¶ added in v0.0.26
CalculateNextEpoch is a function used to calculate the next `SendEpoch` for a given message.
type Node ¶
Node represents an MVDS node, it runs all the logic like sending and receiving protocol messages.
func NewEphemeralNode ¶ added in v0.0.26
func NewNode ¶
func NewNode( ms store.MessageStore, st transport.Transport, ss state.SyncState, nextEpoch CalculateNextEpoch, currentEpoch int64, id state.PeerID, mode Mode, pp peers.Persistence, logger *zap.Logger, ) *Node
NewNode returns a new node.
func NewPersistentNode ¶ added in v0.0.26
func (*Node) AppendMessage ¶
AppendMessage sends a message to a given group.
func (*Node) CurrentEpoch ¶ added in v0.0.26
func (*Node) IsPeerInGroup ¶
IsPeerInGroup checks whether a peer is in the specified group.
func (*Node) RequestMessage ¶ added in v0.0.18
RequestMessage adds a REQUEST record to the next payload for a given message ID.
func (*Node) Start ¶ added in v0.0.14
Start listens for new messages received by the node and sends out those required every epoch.
func (*Node) Stop ¶ added in v0.0.14
func (n *Node) Stop()
Stop message reading and epoch processing
func (*Node) Unsubscribe ¶ added in v0.0.26
func (n *Node) Unsubscribe()
Unsubscribe closes the listening channels
Click to show internal directories.
Click to hide internal directories.