handlers

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: GPL-3.0, LGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockProvider

type BlockProvider interface {
	GetBlock(common.Hash, uint64) *types.Block
}

type BlockRequestHandler

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

BlockRequestHandler is a peer.RequestHandler for message.BlockRequest serving requested blocks starting at specified hash

func NewBlockRequestHandler

func NewBlockRequestHandler(blockProvider BlockProvider, codec codec.Manager, handlerStats stats.BlockRequestHandlerStats) *BlockRequestHandler

func (*BlockRequestHandler) OnBlockRequest

func (b *BlockRequestHandler) OnBlockRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, blockRequest message.BlockRequest) ([]byte, error)

OnBlockRequest handles incoming message.BlockRequest, returning blocks as requested Never returns error Expects returned errors to be treated as FATAL Returns empty response or subset of requested blocks if ctx expires during fetch Assumes ctx is active

type CodeRequestHandler

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

CodeRequestHandler is a peer.RequestHandler for message.CodeRequest serving requested contract code bytes

func NewCodeRequestHandler

func NewCodeRequestHandler(codeReader ethdb.KeyValueReader, codec codec.Manager, stats stats.CodeRequestHandlerStats) *CodeRequestHandler

func (*CodeRequestHandler) OnCodeRequest

func (n *CodeRequestHandler) OnCodeRequest(_ context.Context, nodeID ids.NodeID, requestID uint32, codeRequest message.CodeRequest) ([]byte, error)

OnCodeRequest handles request to retrieve contract code by its hash in message.CodeRequest Never returns error Returns nothing if code hash is not found Expects returned errors to be treated as FATAL Assumes ctx is active

type LeafsRequestHandler

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

LeafsRequestHandler is a peer.RequestHandler for types.LeafsRequest serving requested trie data

func NewLeafsRequestHandler

func NewLeafsRequestHandler(trieDB *trie.Database, snapshotProvider SnapshotProvider, codec codec.Manager, syncerStats stats.LeafsRequestHandlerStats) *LeafsRequestHandler

func (*LeafsRequestHandler) OnLeafsRequest

func (lrh *LeafsRequestHandler) OnLeafsRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, leafsRequest message.LeafsRequest) ([]byte, error)

OnLeafsRequest returns encoded message.LeafsResponse for a given message.LeafsRequest Returns leaves with proofs for specified (Start-End) (both inclusive) ranges Returned message.LeafsResponse may contain partial leaves within requested Start and End range if: - ctx expired while fetching leafs - number of leaves read is greater than Limit (message.LeafsRequest) Specified Limit in message.LeafsRequest is overridden to maxLeavesLimit if it is greater than maxLeavesLimit Expects returned errors to be treated as FATAL Never returns errors Returns nothing if the requested trie root is not found Assumes ctx is active

type SnapshotProvider

type SnapshotProvider interface {
	Snapshots() *snapshot.Tree
}

type SyncDataProvider

type SyncDataProvider interface {
	BlockProvider
	SnapshotProvider
}

type TestBlockProvider

type TestBlockProvider struct {
	GetBlockFn func(common.Hash, uint64) *types.Block
}

func (*TestBlockProvider) GetBlock

func (t *TestBlockProvider) GetBlock(hash common.Hash, number uint64) *types.Block

type TestSnapshotProvider

type TestSnapshotProvider struct {
	Snapshot *snapshot.Tree
}

func (*TestSnapshotProvider) Snapshots

func (t *TestSnapshotProvider) Snapshots() *snapshot.Tree

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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