handlers

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSyncHandler

func NewSyncHandler(
	stateTrieLeafsRequestHandler *LeafsRequestHandler,
	atomicTrieLeafsRequestHandler *LeafsRequestHandler,
	blockRequestHandler *BlockRequestHandler,
	codeRequestHandler *CodeRequestHandler,
) message.RequestHandler

Types

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(getter func(common.Hash, uint64) *types.Block, codec codec.Manager, handlerStats stats.HandlerStats) *BlockRequestHandler

func (*BlockRequestHandler) OnBlockRequest

func (b *BlockRequestHandler) OnBlockRequest(ctx context.Context, nodeID ids.ShortID, 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, stats stats.HandlerStats, codec codec.Manager) *CodeRequestHandler

func (*CodeRequestHandler) OnCodeRequest

func (n *CodeRequestHandler) OnCodeRequest(_ context.Context, nodeID ids.ShortID, 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, syncerStats stats.HandlerStats, codec codec.Manager) *LeafsRequestHandler

func (*LeafsRequestHandler) OnLeafsRequest

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

OnLeafsRequest returns encoded message.LeafsResponse for a given message.LeafsRequest 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 NodeType is invalid or requested trie root is not found Assumes ctx is active

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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