myc

package
v0.0.0-...-dab54ce Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2017 License: LGPL-3.0 Imports: 12 Imported by: 1

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

func (m *Mycelium) Bind(n protocol.Node) error

Bind binds the Mycelium to a specific peer. It starts a listening routine for the node incoming messages.

func (*Mycelium) Broadcast

func (m *Mycelium) Broadcast(from *Peer, call *protocol.Call) (sent int)

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) Close

func (m *Mycelium) Close() error

Close shuts down the whole local Mycelium, closing every open connection.

func (*Mycelium) StartFullSync

func (m *Mycelium) StartFullSync(peer string)

StartFullSync starts a full state-transfer recovery by asking a (hopefully) trusted node his full catalog of (key, version) pairs.

func (*Mycelium) StartRecovery

func (m *Mycelium) StartRecovery(key string, quorum int)

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

func (m *Mycelium) StopRecovery(key string)

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.

type Peer

type Peer struct {
	protocol.Node
	// contains filtered or unexported fields
}

Peer is the structure used to represent a peer of the Mycelium.

func (*Peer) Close

func (p *Peer) Close() error

Close properly shuts down node's connection.

func (*Peer) Equals

func (p *Peer) Equals(p2 *Peer) bool

Equals shall be used to compare two peers.

Directories

Path Synopsis
Package protocol holds the SporeDB mycelium protocol.
Package protocol holds the SporeDB mycelium protocol.
Package sec provides security primitives for the SporeDB mycelium.
Package sec provides security primitives for the SporeDB mycelium.

Jump to

Keyboard shortcuts

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