network

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: Apache-2.0 Imports: 1 Imported by: 11

Documentation

Overview

Package network is a package for defining a network overlay

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Link interface {
	// remote node
	Node
	// length of link which dictates speed
	Length() int
	// weight of link which dictates curvature
	Weight() int
}

Link is a connection to another node

type Message

type Message []byte

Message is the base type for opaque data

type Network

type Network interface {
	options.Options
	// Id of this node
	Id() uint64
	// Connect to a node
	Connect(id uint64) (Link, error)
	// Close the network connection
	Close() error
	// Accept messages on the network
	Accept() (*Message, error)
	// Send a message to the network
	Send(*Message) error
	// Retrieve list of connections
	Links() ([]Link, error)
}

Network is an interface defining networks or graphs

var (
	// TODO: set default network
	DefaultNetwork Network
)

type Node

type Node interface {
	// Node is a network. Network is a node.
	Network
}

Node represents a network node

Jump to

Keyboard shortcuts

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