state

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: Unlicense Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var F, E, W, I, D, T log.LevelPrinter = log.GetLogPrinterSet(subsystem)

Functions

func BlockDb

func BlockDb(cx *State, dbType string, namePrefix string) string

BlockDb returns the path to the block database given a database type.

func GetContext

func GetContext(cx *State) *chainrpc.Context

func GetFreePort

func GetFreePort() (int, error)

GetFreePort asks the kernel for free open ports that are ready to use.

Types

type State

type State struct {
	sync.Mutex
	WaitGroup sync.WaitGroup
	KillAll   qu.C
	// Config is the pod all-in-one server config
	Config *config.Config
	// ConfigMap
	ConfigMap map[string]opt.Option
	// StateCfg is a reference to the main node state configuration struct
	StateCfg *active.Config
	// ActiveNet is the active net parameters
	ActiveNet *chaincfg.Params
	// Language libraries
	Language *lang.Lexicon
	// Node is the run state of the node
	Node atomic.Bool
	// NodeReady is closed when it is ready then always returns
	NodeReady qu.C
	// NodeKill is the killswitch for the Node
	NodeKill qu.C
	// Wallet is the run state of the wallet
	Wallet atomic.Bool
	// WalletKill is the killswitch for the Wallet
	WalletKill qu.C
	// RPCServer is needed to directly query data
	RPCServer *chainrpc.Server
	// NodeChan relays the chain RPC server to the main
	NodeChan chan *chainrpc.Server
	// // WalletServer is needed to query the wallet
	// WalletServer *wallet.Wallet
	// ChainClientReady signals when the chain client is ready
	ChainClientReady qu.C
	// ChainClient is the wallet's chain RPC client
	ChainClient *chainclient.RPCClient
	// RealNode is the main node
	RealNode *chainrpc.Node
	// Hashrate is the current total hashrate from kopach workers taking work from this node
	Hashrate atomic.Uint64
	// Controller is the state of the controller
	Controller *ctrl.State
	// OtherNodesCounter is the count of nodes connected automatically on the LAN
	OtherNodesCounter atomic.Int32

	Syncing *atomic.Bool
	IsGUI   bool
	// contains filtered or unexported fields
}

State stores all the common state data used in pod

func GetNew

func GetNew(
	config *config.Config, hf func(ifc interface{}) error,
	quit qu.C,
) (s *State, e error)

GetNew returns a fresh new context

func (*State) PrintWaitChangers

func (cx *State) PrintWaitChangers() string

func (*State) WaitAdd

func (cx *State) WaitAdd()

func (*State) WaitDone

func (cx *State) WaitDone()

func (*State) WaitWait

func (cx *State) WaitWait()

Jump to

Keyboard shortcuts

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