node

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: GPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type P2PNode

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

P2PNode represents a libp2p node

func NewNode

func NewNode(ctx context.Context, quitCh chan struct{}) (*P2PNode, error)

Returns a new libp2p node. The node is created with the given context and options passed as arguments.

func (*P2PNode) AdjustPeerQuality added in v0.32.0

func (p *P2PNode) AdjustPeerQuality(peer p2p.PeerID, topic string, adjFn func(int) int)

func (*P2PNode) BanPeer

func (p *P2PNode) BanPeer(peer p2p.PeerID)

func (*P2PNode) Broadcast

func (p *P2PNode) Broadcast(location common.Location, data interface{}) error

func (*P2PNode) Close added in v0.30.0

func (p *P2PNode) Close() error

Close performs cleanup of resources used by P2PNode

func (*P2PNode) Connect

func (p *P2PNode) Connect(pi peer.AddrInfo) error

Connects to the given peer

func (*P2PNode) GetBandwidthCounter added in v0.31.0

func (p *P2PNode) GetBandwidthCounter() libp2pmetrics.Reporter

func (*P2PNode) GetBlockByNumber added in v0.31.0

func (p *P2PNode) GetBlockByNumber(number *big.Int, location common.Location) *types.WorkObject

func (*P2PNode) GetBlockHashByNumber

func (p *P2PNode) GetBlockHashByNumber(number *big.Int, location common.Location) *common.Hash

func (*P2PNode) GetHeight added in v0.37.0

func (p *P2PNode) GetHeight(location common.Location) uint64

func (*P2PNode) GetHostBackend

func (p *P2PNode) GetHostBackend() host.Host

func (*P2PNode) GetPeerManager

func (p *P2PNode) GetPeerManager() peerManager.PeerManager

func (*P2PNode) GetRequestManager

func (p *P2PNode) GetRequestManager() requestManager.RequestManager

func (*P2PNode) GetStream added in v0.30.0

func (p *P2PNode) GetStream(peerID peer.ID) (network.Stream, error)

Opens a new stream to the given peer using the given protocol ID

func (*P2PNode) GetWorkObject

func (p *P2PNode) GetWorkObject(hash common.Hash, location common.Location) *types.WorkObject

Search for a block in the node's cache, or query the consensus backend if it's not found in cache. Returns nil if the block is not found.

func (*P2PNode) GetWorkObjectsFrom added in v0.31.0

func (p *P2PNode) GetWorkObjectsFrom(hash common.Hash, location common.Location, count int) []*types.WorkObjectBlockView

Search for the block in the data base and get the count number of the next blocks

func (*P2PNode) ProtectPeer

func (p *P2PNode) ProtectPeer(peer p2p.PeerID)

func (*P2PNode) Request

func (p *P2PNode) Request(location common.Location, requestData interface{}, responseDataType interface{}) chan interface{}

Request a data from the network for the specified slice

func (*P2PNode) SetConsensusBackend

func (p *P2PNode) SetConsensusBackend(be quai.ConsensusAPI)

func (*P2PNode) Start

func (p *P2PNode) Start() error

Starts the node and all of its services

func (*P2PNode) Stop

func (p *P2PNode) Stop() error

Function to gracefully shtudown all running services

func (*P2PNode) Subscribe

func (p *P2PNode) Subscribe(location common.Location, datatype interface{}) error

func (*P2PNode) UnprotectPeer

func (p *P2PNode) UnprotectPeer(peer p2p.PeerID)

func (*P2PNode) Unsubscribe

func (p *P2PNode) Unsubscribe(location common.Location, datatype interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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