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
Click to show internal directories.
Click to hide internal directories.