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.
Click to show internal directories.
Click to hide internal directories.