Documentation
¶
Overview ¶
Package myc contains the SporeDB mycelium logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mycelium ¶
type Mycelium struct { Peers []*Peer Nodes []protocol.Node DB *db.DB // contains filtered or unexported fields }
Mycelium is the structure used to represent the SporeDB network of nodes.
func NewMycelium ¶
func NewMycelium(c *MyceliumConfig) (*Mycelium, error)
NewMycelium setups a new Mycelium from its configuration.
func (*Mycelium) Bind ¶
Bind binds the Mycelium to a specific peer. It starts a listening routine for the node incoming messages.
func (*Mycelium) Broadcast ¶
Broadcast may be used to send a protocol call to connected peers. If `from` is not nil, no message will be sent to the provided peer.
func (*Mycelium) StartFullSync ¶
StartFullSync starts a full state-transfer recovery by asking a (hopefully) trusted node his full catalog of (key, version) pairs.
func (*Mycelium) StartRecovery ¶
StartRecovery registers a new recovery process for the specified key. The new value will be considered trusted if at least "quorum" answers are identical.
func (*Mycelium) StopRecovery ¶
StopRecovery aborts a recovery process for the specified key.
type MyceliumConfig ¶
type MyceliumConfig struct { Self []string // Self addresses, used to avoid self-connections Listen string // Peer API of this mycelium, might be empty to disable listenning. Peers []protocol.Node // Bootstrapping nodes. A connection will be attempted for each node of this slice. DB *db.DB // Related local database RecoveryQuorum int }
MyceliumConfig is the structure used to setup a new Mycelium.