Documentation ¶
Index ¶
- type LocalNode
- type Overlay
- type OverlayClient
- func (o *OverlayClient) Create(ctx context.Context, appNode LocalNode) error
- func (o *OverlayClient) Join(ctx context.Context, overlayNodeIP string, overlayNodePort int, ...) error
- func (o *OverlayClient) Leave(ctx context.Context) error
- func (o *OverlayClient) Lookup(ctx context.Context, key []byte) ([]*OverlayNode, error)
- func (o *OverlayClient) Neighbors(ctx context.Context, nodeID []byte) ([]*OverlayNode, error)
- func (o *OverlayClient) NodeID(ctx context.Context) ([]byte, error)
- type OverlayNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalNode ¶
type LocalNode interface { // AddTrader is called when a new local virtual node joins the overlay. AddTrader(guid []byte) // GUID returns the node's GUID. GUID() string }
LocalNode exposes the overlay to the application node.
type Overlay ¶
type Overlay interface { // Create/Bootstrap the overlay in the current node. Create(ctx context.Context, thisNode LocalNode) 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 LocalNode) 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 OverlayClient ¶
type OverlayClient struct {
// contains filtered or unexported fields
}
OverlayClient is the base intermediate structure that interacts with the specific overlay implementations.
func NewOverlayClient ¶
func NewOverlayClient(specificOverlay Overlay, localNode LocalNode) *OverlayClient
func (*OverlayClient) Create ¶
func (o *OverlayClient) Create(ctx context.Context, appNode LocalNode) error
func (*OverlayClient) Lookup ¶
func (o *OverlayClient) Lookup(ctx context.Context, key []byte) ([]*OverlayNode, error)
func (*OverlayClient) Neighbors ¶
func (o *OverlayClient) Neighbors(ctx context.Context, nodeID []byte) ([]*OverlayNode, error)
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.