nodectx

package
v0.0.0-...-6b2b62e Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package nodectx provides context for node.

Index

Constants

View Source
const (
	USER_CHANNEL_PREFIX     = "user_channel_"
	PRODUCER_CHANNEL_PREFIX = "prod_channel_"

	NODE_ONLINE  = 0
	NODE_OFFLINE = 1
)

Variables

This section is empty.

Functions

func GetDbMgr

func GetDbMgr() *storage.DbMgr

func InitCtx

func InitCtx(ctx context.Context, name string, node *p2p.Node, db *storage.DbMgr, channeltype string, gitcommit string)

Types

type NodeCtx

type NodeCtx struct {
	Node       *p2p.Node
	PeerId     peer.ID
	Keystore   localcrypto.Keystore
	PublickKey p2pcrypto.PubKey
	Name       string
	Ctx        context.Context
	Version    string
	Status     NodeStatus
	Economic   int
}

func GetNodeCtx

func GetNodeCtx() *NodeCtx

func (*NodeCtx) AddPeers

func (nodeCtx *NodeCtx) AddPeers(peers []peer.AddrInfo) int

func (*NodeCtx) GetNodePubKey

func (nodeCtx *NodeCtx) GetNodePubKey() (string, error)

func (*NodeCtx) ListGroupPeers

func (nodeCtx *NodeCtx) ListGroupPeers(groupid string) []peer.ID

func (*NodeCtx) PeersProtocol

func (nodeCtx *NodeCtx) PeersProtocol() *map[string][]string

func (*NodeCtx) ProtocolPrefix

func (nodeCtx *NodeCtx) ProtocolPrefix() string

func (*NodeCtx) UpdateOnlineStatus

func (nodeCtx *NodeCtx) UpdateOnlineStatus(status NodeStatus)

type NodeStatus

type NodeStatus int8

Jump to

Keyboard shortcuts

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