nodekeeper

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeKeeper

type NodeKeeper interface {
	// GetActiveNode get active node by its reference. Returns nil if node is not found.
	GetActiveNode(ref core.RecordRef) *core.ActiveNode
	// GetActiveNodes get active nodes.
	GetActiveNodes() []*core.ActiveNode
	// AddActiveNodes set active nodes.
	AddActiveNodes([]*core.ActiveNode)
	// GetUnsyncHash get hash computed based on the list of unsync nodes, and the size of this list.
	GetUnsyncHash() (hash []byte, unsyncCount int, err error)
	// GetUnsync gets the local unsync list (excluding other nodes unsync lists).
	GetUnsync() []*core.ActiveNode
	// SetPulse sets internal PulseNumber to number.
	SetPulse(number core.PulseNumber)
	// Sync initiate transferring unsync -> sync, sync -> active. If approved is false, unsync is not transferred to sync.
	Sync(approved bool)
	// AddUnsync add unsync node to the local unsync list.
	// Returns error if node's PulseNumber is not equal to the NodeKeeper internal PulseNumber.
	AddUnsync(*core.ActiveNode) error
	// AddUnsyncGossip merge unsync list from another node to the local unsync list.
	// Returns error if:
	// 1. One of the nodes' PulseNumber is not equal to the NodeKeeper internal PulseNumber;
	// 2. One of the nodes' reference is equal to one of the local unsync nodes' reference.
	AddUnsyncGossip([]*core.ActiveNode) error
}

func NewNodeKeeper added in v0.5.0

func NewNodeKeeper(unsyncDiscardAfter time.Duration) NodeKeeper

NewNodeKeeper create new NodeKeeper. unsyncDiscardAfter = timeout after which each unsync node is discarded.

Jump to

Keyboard shortcuts

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