node

package
v0.0.0-...-bda66fc Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: ISC Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// MaxMsgSize specifies the largest packet size for grpc calls
	MaxMsgSize = 5242880
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HashDiff

type HashDiff struct {
	Additions []hash.Hash
	Deletions []hash.Hash
}

HashDiff stores the diff between two tangles

type Node

type Node struct {
	Tangle          *tangle.Tangle
	ListenInterface string
	Version         string

	APIAddr string
	Hooks   struct {
		PreAdd string
	}
	// contains filtered or unexported fields
}

Node is a wrapper around the chain. Nodes are the backbone of the network

func New

func New(c config.Configuration) (*Node, error)

New constructs a new node from the configuration

func (*Node) AddSite

func (n *Node) AddSite(ctx context.Context, s *d.Site) (*d.SuccessReturn, error)

AddSite receives a sent Site from other node

func (*Node) Connect

func (n *Node) Connect(r string) error

Connect connects to a new remote

func (*Node) GetInfo

func (n *Node) GetInfo(ctx context.Context, r *d.Info) (*d.Info, error)

GetInfo is a all purpose status request

func (*Node) Info

func (n *Node) Info() *d.Info

Info returns the serializable info struct

func (*Node) Merge

func (n *Node) Merge(r string) error

Merge requests to merge with a remote

func (*Node) Push

func (n *Node) Push(o *tangle.Object) error

Push sends a site to all connected nodes

func (*Node) RemoteStatus

func (n *Node) RemoteStatus(s string) (*Status, error)

RemoteStatus returns the status of a connected remote

func (*Node) Run

func (n *Node) Run()

Run listens for connections to this node

func (*Node) Splice

func (n *Node) Splice(stream d.DistributionService_SpliceServer) error

Splice injects the recieved sites into the tangle

func (*Node) Status

func (n *Node) Status() Status

Status returns the current running configuration of the node

func (*Node) Submit

func (n *Node) Submit(o *tangle.Object) error

Submit is called whenever a new site is submitted to the network

type Status

type Status struct {
	Address        string      `json:"address"`
	Version        string      `json:"version"`
	Length         uint64      `json:"length"`
	Connections    []string    `json:"connections"`
	Recomendations []string    `json:"recomendations"`
	Hashes         []hash.Hash `json:"-"`
	HashDiff       HashDiff    `json:"-"`
}

Status is used for reporting this nodes configuration to other nodes

Directories

Path Synopsis
Package node is a generated protocol buffer package.
Package node is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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