Documentation ¶
Index ¶
- Variables
- func AbnormalError(err error) bool
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) ReadHello(limit int, timeout time.Duration) (*service.Hello, error)
- func (c *Conn) ReadMessage(limit int, timeout time.Duration) (*service.Message, error)
- func (c *Conn) WritePayload(pb proto.Message, limit int, timeout time.Duration) error
- func (c *Conn) WriteRequest(msg *service.Message, limit int, timeout time.Duration) (id uint64, err error)
- type NetTopology
- type Topology
- func (t *Topology) BootstrapMDNS()
- func (t *Topology) BootstrapRegistries(registries []config.Registry)
- func (t *Topology) BootstrapStatic(addresses map[uint64]string) error
- func (t *Topology) Dial(nodeID uint64, timeout time.Duration) (*Conn, error)
- func (t *Topology) Lookup(nodeID uint64) string
- func (t *Topology) Nodes() []uint64
- func (t *Topology) SeedPublicKeys() map[uint64]signature.PublicKey
- func (t *Topology) TotalNodes() uint64
Constants ¶
This section is empty.
Variables ¶
var (
ErrNodeWithZeroID = errors.New("network: received invalid Node ID: 0")
)
Error values.
Functions ¶
func AbnormalError ¶
AbnormalError returns whether the given error was abnormal, i.e. not EOF or a timeout error.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents a connection to a Chainspace node.
func (*Conn) ReadMessage ¶
ReadMessage reads a service.Message from the underlying connection.
func (*Conn) WritePayload ¶
WritePayload encodes the given payload into protobuf and writes the marshalled data to the underlying connection, along with a header indicating the length of the data.
type NetTopology ¶
type Topology ¶
type Topology struct {
// contains filtered or unexported fields
}
Topology represents a Chainspace network.
func New ¶
New parses the given network configuration and creates a network topology for connecting to nodes.
func (*Topology) BootstrapMDNS ¶
func (t *Topology) BootstrapMDNS()
BootstrapMDNS will try to auto-discover the addresses of initial nodes using multicast DNS.
func (*Topology) BootstrapRegistries ¶
BootstrapRegistries will use the given registries to discover the initial addresses of nodes in the network.
func (*Topology) BootstrapStatic ¶
BootstrapStatic will use the given static map of addresses for the initial addresses of nodes in the network.
func (*Topology) Dial ¶
Dial opens a connection to a node in the given network. It will block if unable to find a routing address for the given node.
func (*Topology) SeedPublicKeys ¶
func (*Topology) TotalNodes ¶
TotalNodes returns the total number of nodes in the network.