nodes

package
v0.0.0-...-62bb9e5 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Online  = Status(log.Bold(log.Green("online")))
	Offline = Status(log.Bold(log.Red("offline")))
)

Statuses of a node.

Functions

func Add

func Add(ctx context.Context, nodeConf *protocol.ClientConfig)

Add a new node the list of nodes.

func Delete

func Delete(n *node) bool

Delete a node from the list of nodes.

func Get

func Get(addr string) *node

Get a node from the list of nodes.

func GetAddr

func GetAddr(ctx context.Context) string

GetAddr of a node from the context

func GetAll

func GetAll() *map[string]*node

GetAll nodes.

func GetPeer

func GetPeer(ctx context.Context) *peer.Peer

GetPeer gets the address:port of a node.

func GetStats

func GetStats() (stats []*protocol.Statistics)

GetStats returns the stats of all nodes combined.

func NewNode

func NewNode(ctx context.Context, nodeConf *protocol.ClientConfig) *node

NewNode instanstiates a new node.

func SetNotificationsChannel

func SetNotificationsChannel(notificationsStream protocol.UI_NotificationsServer) *node

SetNotificationsChannel sets the communication channel for a given node. https://github.com/grpc/grpc-go/blob/master/stream.go

func Total

func Total() int

Total returns the number of saved nodes.

func UpdateStats

func UpdateStats(ctx context.Context, stats *protocol.Statistics)

UpdateStats of a node.

Types

type Status

type Status string

Status represents the current connectivity status of a node.

Jump to

Keyboard shortcuts

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