node

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2021 License: ISC Imports: 33 Imported by: 0

Documentation

Overview

Copyright (c) 2020-2021 The bitcoinpay 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) 2020-2021 The bitcoinpay developers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UseLogger

func UseLogger(logger l.Logger)

UseLogger uses a specified Logger to output package logging info.

Types

type BitcoinpayFull

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

BitcoinpayFull implements the Bitcoinpay full node service.

func (*BitcoinpayFull) APIs

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

func (*BitcoinpayFull) GetAddressApi

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

return address api

func (*BitcoinpayFull) GetBlockManager

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

return block manager

func (*BitcoinpayFull) GetCpuMiner

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

return cpu miner

func (*BitcoinpayFull) GetPeerServer

func (qm *BitcoinpayFull) GetPeerServer() *peerserver.PeerServer

return peer server

func (*BitcoinpayFull) Start

func (qm *BitcoinpayFull) Start(server *peerserver.PeerServer) error

func (*BitcoinpayFull) Stop

func (qm *BitcoinpayFull) Stop() error

type BitcoinpayLight

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

BitcoinpayLight implements the bitcoinpay light node service.

func (*BitcoinpayLight) APIs

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

func (*BitcoinpayLight) Start

func (light *BitcoinpayLight) Start(server *peerserver.PeerServer) error

func (*BitcoinpayLight) Stop

func (light *BitcoinpayLight) Stop() error

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) GetBitcoinpayFull

func (n *Node) GetBitcoinpayFull() *BitcoinpayFull

return bitcoinpay 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 *BitcoinpayFull) *PrivateBlockChainAPI

func (*PrivateBlockChainAPI) Banlist

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

Banlist

func (*PrivateBlockChainAPI) RemoveBan

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

RemoveBan

func (*PrivateBlockChainAPI) SetRpcMaxClients

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

SetRpcMaxClients

func (*PrivateBlockChainAPI) Stop

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

Stop the node

type PrivateLogAPI

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

func NewPrivateLogAPI

func NewPrivateLogAPI(node *BitcoinpayFull) *PrivateLogAPI

func (*PrivateLogAPI) SetLogLevel

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 *BitcoinpayFull) *PublicBlockChainAPI

func (*PublicBlockChainAPI) GetNodeInfo

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

Return the node info

func (*PublicBlockChainAPI) GetPeerInfo

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

Return the peer info

func (*PublicBlockChainAPI) GetRpcInfo

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

Return the RPC info

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(server *peerserver.PeerServer) 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