l1

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: MIT, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DownloadEvictedErr = errors.New("evicted")
	DownloadClosedErr  = errors.New("closed")
)

Functions

This section is empty.

Types

type DownloadSource

type DownloadSource interface {
	eth.BlockByHashSource
	eth.ReceiptSource
}

type Downloader

type Downloader interface {
	// Fetch downloads a block and all the corresponding transaction receipts.
	// Past and ongoing download jobs are cached in an LRU to de-duplicate work.
	//
	// If the Downloader is closed, then a DownloadClosedErr is returned.
	//
	// If the Downloader is stressed with too many new requests,
	// a long call may be evicted and return a DownloadEvictedErr.
	//
	// If the provided ctx is done the download may also finish with the context error.
	//
	// Internal timeouts are maintained to ensure nothing halts the downloader indefinitely.
	Fetch(ctx context.Context, id eth.BlockID) (*types.Block, []*types.Receipt, error)
	// AddReceiptWorkers can add n parallel workers, or remove if n < 0, or no-op if n == 0.
	// It then returns the new number of workers.
	AddReceiptWorkers(n int) int
	Close()
}

func NewDownloader

func NewDownloader(dlSource DownloadSource) Downloader

Jump to

Keyboard shortcuts

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