node

package
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2019 License: MIT Imports: 11 Imported by: 2 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package Node contains node logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mode

type Mode int

Mode represents the synchronization mode.

const (
	INTERACTIVE Mode = iota
	BATCH
)

type Node

type Node struct {
	ID state.PeerID
	// contains filtered or unexported fields
}

Node represents an MVDS node, it runs all the logic like sending and receiving protocol messages.

func NewNode

func NewNode(
	ms store.MessageStore,
	st transport.Transport,
	ss state.SyncState,
	nextEpoch calculateNextEpoch,
	currentEpoch int64,
	id state.PeerID,
	mode Mode,
) *Node

NewNode returns a new node.

func (*Node) AddPeer

func (n *Node) AddPeer(group state.GroupID, id state.PeerID)

AddPeer adds a peer to a specific group making it a recipient of messages.

func (*Node) AppendMessage

func (n *Node) AppendMessage(group state.GroupID, data []byte) (state.MessageID, error)

AppendMessage sends a message to a given group.

func (Node) IsPeerInGroup

func (n Node) IsPeerInGroup(g state.GroupID, p state.PeerID) bool

IsPeerInGroup checks whether a peer is in the specified group.

func (*Node) Start added in v0.0.14

func (n *Node) Start()

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL