handlers

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: GPL-3.0, LGPL-3.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLeafsRequestHandler

func NewLeafsRequestHandler(trieDB *triedb.Database, trieKeyLength int, snapshotProvider SnapshotProvider, codec codec.Manager, syncerStats stats.LeafsRequestHandlerStats) *leafsRequestHandler

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 LeafRequestHandler added in v0.8.1

type LeafRequestHandler interface {
	OnLeafsRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, leafsRequest message.LeafsRequest) ([]byte, error)
}

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