node

package
v0.0.0-...-953790c Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2018 License: MPL-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNodeExists                  = errors.New("node is already running")
	ErrNoRunningNode               = errors.New("there is no running node")
	ErrInvalidNodeManager          = errors.New("node manager is not properly initialized")
	ErrInvalidWhisperService       = errors.New("whisper service is unavailable")
	ErrInvalidLightEthereumService = errors.New("LES service is unavailable")
	ErrInvalidAccountManager       = errors.New("could not retrieve account manager")
	ErrAccountKeyStoreMissing      = errors.New("account key store is not set")
	ErrRPCClient                   = errors.New("failed to init RPC client")
)

errors

View Source
var (
	ErrEthServiceRegistrationFailure     = errors.New("failed to register the Ethereum service")
	ErrWhisperServiceRegistrationFailure = errors.New("failed to register the Whisper service")
	ErrLightEthRegistrationFailure       = errors.New("failed to register the LES service")
	ErrNodeMakeFailure                   = errors.New("error creating p2p node")
	ErrNodeRunFailure                    = errors.New("error running p2p node")
	ErrNodeStartFailure                  = errors.New("error starting p2p node")
)

node-related errors

View Source
var (
	ErrStartAborted = errors.New("node synchronization timeout before starting")
	ErrSyncAborted  = errors.New("node synchronization timeout before completion")
)

errors

Functions

func HaltOnInterruptSignal

func HaltOnInterruptSignal(nodeManager *NodeManager)

HaltOnInterruptSignal stops node and panics if you press Ctrl-C enough times

func HaltOnPanic

func HaltOnPanic()

HaltOnPanic recovers from panic, logs issue, sends upward notification, and exits

func MakeNode

func MakeNode(config *params.NodeConfig, deliveryServer whisper.DeliveryServer) (*node.Node, error)

MakeNode create a geth node entity

Types

type LogDeliveryService

type LogDeliveryService struct{}

LogDeliveryService implements the whisper.DeliveryServer which logs out stats of whisper.MessageState to the log.

func (LogDeliveryService) SendState

func (ld LogDeliveryService) SendState(state whisper.MessageState)

SendState logs incoming whisper.MesssageState into the log.

type NodeManager

type NodeManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

NodeManager manages Status node (which abstracts contained geth node) nolint: golint should be fixed at https://github.com/status-im/status-go/issues/200

func NewNodeManager

func NewNodeManager() *NodeManager

NewNodeManager makes new instance of node manager

func (*NodeManager) AccountKeyStore

func (m *NodeManager) AccountKeyStore() (*keystore.KeyStore, error)

AccountKeyStore exposes reference to accounts key store

func (*NodeManager) AccountManager

func (m *NodeManager) AccountManager() (*accounts.Manager, error)

AccountManager exposes reference to node's accounts manager

func (*NodeManager) AddPeer

func (m *NodeManager) AddPeer(url string) error

AddPeer adds new static peer node

func (*NodeManager) IsNodeRunning

func (m *NodeManager) IsNodeRunning() bool

IsNodeRunning confirm that node is running

func (*NodeManager) LightEthereumService

func (m *NodeManager) LightEthereumService() (*les.LightEthereum, error)

LightEthereumService exposes reference to LES service running on top of the node

func (*NodeManager) Node

func (m *NodeManager) Node() (*node.Node, error)

Node returns underlying Status node

func (*NodeManager) NodeConfig

func (m *NodeManager) NodeConfig() (*params.NodeConfig, error)

NodeConfig exposes reference to running node's configuration

func (*NodeManager) PopulateStaticPeers

func (m *NodeManager) PopulateStaticPeers() error

PopulateStaticPeers connects current node with our publicly available LES/SHH/Swarm cluster

func (*NodeManager) RPCClient

func (m *NodeManager) RPCClient() *rpc.Client

RPCClient exposes reference to RPC client connected to the running node.

func (*NodeManager) ResetChainData

func (m *NodeManager) ResetChainData() (<-chan struct{}, error)

ResetChainData remove chain data from data directory. Node is stopped, and new node is started, with clean data directory.

func (*NodeManager) RestartNode

func (m *NodeManager) RestartNode() (<-chan struct{}, error)

RestartNode restart running Status node, fails if node is not running

func (*NodeManager) StartNode

func (m *NodeManager) StartNode(config *params.NodeConfig) (<-chan struct{}, error)

StartNode start Status node, fails if node is already started

func (*NodeManager) StopNode

func (m *NodeManager) StopNode() (<-chan struct{}, error)

StopNode stop Status node. Stopped node cannot be resumed.

func (*NodeManager) WhisperService

func (m *NodeManager) WhisperService() (*whisper.Whisper, error)

WhisperService exposes reference to Whisper service running on top of the node

type SyncPoll

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

SyncPoll provides a structure that allows us to check the status of ethereum node synchronization.

func NewSyncPoll

func NewSyncPoll(leth *les.LightEthereum) *SyncPoll

NewSyncPoll returns a new instance of SyncPoll.

func (*SyncPoll) Poll

func (n *SyncPoll) Poll(ctx context.Context) error

Poll checks for the status of blockchain synchronization and returns an error if the blockchain failed to start synchronizing or fails to complete, within the time provided by the passed in context.

Jump to

Keyboard shortcuts

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