types

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2018 License: GPL-3.0 Imports: 1 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Overlay added in v0.3.0

type Overlay interface {
	// Create/Bootstrap the overlay in the current node.
	Create(ctx context.Context, thisNode OverlayMembership) error

	// Join an overlay given a participant node IP and the respective port where its overlay daemon is listening.
	Join(ctx context.Context, overlayNodeIP string, overlayNodePort int, thisNode OverlayMembership) error

	// Get a list of remote nodes using a given key.
	Lookup(ctx context.Context, key []byte) ([]*OverlayNode, error)

	// Get a list of the neighbors nodes of the given node.
	Neighbors(ctx context.Context, nodeID []byte) ([]*OverlayNode, error)

	// Unique identifier for the physical node where the overlay is running.
	// The overlay can have virtual nodes here we only want return always one ID that is unique in all nodes.
	NodeID(ctx context.Context) ([]byte, error)

	// Leave the overlay.
	Leave(ctx context.Context) error
}

Overlay represents an API for a distributed overlay of nodes that allows us to create a new instance of the overlay, join it, leave it, lookup for nodes by a given key and get the neighbors of a specific node.

type OverlayMembership

type OverlayMembership interface {
	// Called when a new local virtual node joins the overlay.
	AddTrader(guid []byte)
}

Node interface exposed to the overlay below.

type OverlayNode

type OverlayNode struct {
	// contains filtered or unexported fields
}

Represents a generic overlay node.

func NewOverlayNode

func NewOverlayNode(nodeIP string, port int, guid []byte) *OverlayNode

NewOverlayNode creates a new overlay node.

func (*OverlayNode) GUID

func (rn *OverlayNode) GUID() []byte

Node identifier

func (*OverlayNode) IP

func (rn *OverlayNode) IP() string

IP of the node

func (*OverlayNode) Port

func (rn *OverlayNode) Port() int

Port of the overlay daemon

Jump to

Keyboard shortcuts

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