node

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: ISC Imports: 37 Imported by: 0

Documentation

Overview

Copyright (c) 2017-2018 The qitmeer developers Copyright (c) 2013-2016 The btcsuite developers Copyright (c) 2017-2018 The Decred developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.

Copyright (c) 2017-2018 The qitmeer developers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGraphStateResult added in v0.10.3

func GetGraphStateResult(gs *blockdag.GraphState) *json.GetGraphStateResult

func UseLogger

func UseLogger(logger l.Logger)

UseLogger uses a specified Logger to output package logging info.

Types

type Node

type Node struct {

	// config
	Config *config.Config
	Params *params.Params

	// database layer
	DB database.DB
	// contains filtered or unexported fields
}

Node works as a server container for all service can be registered. such as p2p, rpc, ws etc.

func NewNode

func NewNode(cfg *config.Config, database database.DB, chainParams *params.Params, shutdownRequestChannel chan struct{}) (*Node, error)

func (*Node) GetQitmeerFull

func (n *Node) GetQitmeerFull() *QitmeerFull

return qitmeer full

func (*Node) RegisterService

func (n *Node) RegisterService() error

func (*Node) Start

func (n *Node) Start() error

func (*Node) Stop

func (n *Node) Stop() error

func (*Node) WaitForShutdown

func (n *Node) WaitForShutdown()

WaitForShutdown blocks until the main listener and peer handlers are stopped.

type PrivateBlockChainAPI

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

func NewPrivateBlockChainAPI

func NewPrivateBlockChainAPI(node *QitmeerFull) *PrivateBlockChainAPI

func (*PrivateBlockChainAPI) Banlist added in v0.10.1

func (api *PrivateBlockChainAPI) Banlist() (interface{}, error)

Banlist

func (*PrivateBlockChainAPI) RemoveBan added in v0.10.1

func (api *PrivateBlockChainAPI) RemoveBan(id *string) (interface{}, error)

RemoveBan

func (*PrivateBlockChainAPI) SetRpcMaxClients added in v0.10.1

func (api *PrivateBlockChainAPI) SetRpcMaxClients(max int) (interface{}, error)

SetRpcMaxClients

func (*PrivateBlockChainAPI) Stop

func (api *PrivateBlockChainAPI) Stop() (interface{}, error)

Stop the node

type PrivateLogAPI added in v0.10.1

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

func NewPrivateLogAPI added in v0.10.1

func NewPrivateLogAPI(node *QitmeerFull) *PrivateLogAPI

func (*PrivateLogAPI) SetLogLevel added in v0.10.1

func (api *PrivateLogAPI) SetLogLevel(level string) (interface{}, error)

set log

type PublicBlockChainAPI

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

func NewPublicBlockChainAPI

func NewPublicBlockChainAPI(node *QitmeerFull) *PublicBlockChainAPI

func (*PublicBlockChainAPI) GetNetworkInfo added in v0.10.3

func (api *PublicBlockChainAPI) GetNetworkInfo() (interface{}, error)

func (*PublicBlockChainAPI) GetNodeInfo

func (api *PublicBlockChainAPI) GetNodeInfo() (interface{}, error)

Return the node info

func (*PublicBlockChainAPI) GetPeerInfo

func (api *PublicBlockChainAPI) GetPeerInfo(verbose *bool, network *string) (interface{}, error)

Return the peer info

func (*PublicBlockChainAPI) GetRpcInfo added in v0.10.1

func (api *PublicBlockChainAPI) GetRpcInfo() (interface{}, error)

Return the RPC info

func (*PublicBlockChainAPI) GetTimeInfo added in v0.10.1

func (api *PublicBlockChainAPI) GetTimeInfo() (interface{}, error)

type QitmeerFull

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

QitmeerFull implements the qitmeer full node service.

func (*QitmeerFull) APIs

func (qm *QitmeerFull) APIs() []rpc.API

func (*QitmeerFull) GetAddressApi added in v0.10.1

func (qm *QitmeerFull) GetAddressApi() *address.AddressApi

return address api

func (*QitmeerFull) GetBlockManager

func (qm *QitmeerFull) GetBlockManager() *blkmgr.BlockManager

return block manager

func (*QitmeerFull) GetCpuMiner

func (qm *QitmeerFull) GetCpuMiner() *miner.CPUMiner

return cpu miner

func (*QitmeerFull) GetPeerServer

func (qm *QitmeerFull) GetPeerServer() *p2p.Service

return peer server

func (*QitmeerFull) Start

func (qm *QitmeerFull) Start() error

func (*QitmeerFull) Stop

func (qm *QitmeerFull) Stop() error

type QitmeerLight

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

QitmeerLight implements the qitmeer light node service.

func (*QitmeerLight) APIs

func (light *QitmeerLight) APIs() []rpc.API

func (*QitmeerLight) Start

func (light *QitmeerLight) Start() error

func (*QitmeerLight) Stop

func (light *QitmeerLight) Stop() error

type Service

type Service interface {

	// APIs retrieves the list of RPC descriptors the service provides
	APIs() []rpc.API

	// Start is called after all services have been constructed and the networking
	// layer was also initialized to spawn any goroutines required by the service.
	Start() error

	// Stop terminates all goroutines belonging to the service, blocking until they
	// are all terminated.
	Stop() error
}

Service is a service can be registered into & running in a Node

type ServiceConstructor

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

ServiceConstructor is the function signature of the constructors needed to be registered for service instantiation.

func NewServiceConstructor

func NewServiceConstructor(name string, constructor func(ctx *ServiceContext) (Service, error)) ServiceConstructor

type ServiceContext

type ServiceContext struct {
}

ServiceContext is a collection of service independent options inherited from the protocol stack, that is passed to all constructors to be optionally used; as well as utility methods to operate on the service environment.

type ServiceStopError

type ServiceStopError struct {
	Services map[reflect.Type]error
}

ServiceStopError is returned if a Node fails to stop either any of its registered services or itself.

func (*ServiceStopError) Error

func (e *ServiceStopError) Error() string

Error generates a textual representation of the stop error.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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