networkcoordinator

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractNodeRef added in v0.6.1

func ExtractNodeRef(rawJSON []byte) (string, error)

ExtractNodeRef extract reference from json response

func ExtractRegisterNodeResponse added in v0.6.1

func ExtractRegisterNodeResponse(data []byte) ([]byte, error)

ExtractRegisterNodeResponse extracts response of RegisterNode

func RandomUint64 added in v0.6.2

func RandomUint64() uint64

RandomUint64 generates random uint64

Types

type NetworkCoordinator

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

NetworkCoordinator encapsulates logic of network configuration

func New

func New() (*NetworkCoordinator, error)

New creates new NetworkCoordinator

func (*NetworkCoordinator) Authorize

func (nc *NetworkCoordinator) Authorize(ctx context.Context, nodeRef core.RecordRef, seed []byte, signatureRaw []byte) (string, []core.NodeRole, error)

Authorize authorizes node by verifying it's signature

func (*NetworkCoordinator) RegisterNode

func (nc *NetworkCoordinator) RegisterNode(ctx context.Context, publicKey string, numberOfBootstrapNodes int, majorityRule int, roles []string, ip string) ([]byte, error)

RegisterNode registers node in nodedomain

func (*NetworkCoordinator) Start

Start implements interface of Component

func (*NetworkCoordinator) Stop

func (nc *NetworkCoordinator) Stop(ctx context.Context) error

Stop implements interface of Component

func (*NetworkCoordinator) WriteActiveNodes

func (nc *NetworkCoordinator) WriteActiveNodes(ctx context.Context, number core.PulseNumber, activeNodes []*core.Node) error

WriteActiveNodes writes active nodes to ledger

Jump to

Keyboard shortcuts

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