Documentation ¶
Index ¶
- Variables
- type Downloader
- func (d *Downloader) AddHashes(id string, hashes []common.Hash) error
- func (d *Downloader) DeliverChunk(id string, blocks []*types.Block)
- func (d *Downloader) Has(hash common.Hash) bool
- func (d *Downloader) RegisterPeer(id string, hash common.Hash, getHashes hashFetcherFn, getBlocks blockFetcherFn) error
- func (d *Downloader) Stats() (current int, max int)
- func (d *Downloader) Synchronise(id string, hash common.Hash) error
- func (d *Downloader) TakeBlocks() types.Blocks
- func (d *Downloader) UnregisterPeer(id string)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBusy = errors.New("busy") ErrTimeout = errors.New("timeout") )
Functions ¶
This section is empty.
Types ¶
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
func New ¶
func New(hasBlock hashCheckFn, getBlock getBlockFn) *Downloader
func (*Downloader) AddHashes ¶ added in v0.9.17
func (d *Downloader) AddHashes(id string, hashes []common.Hash) error
func (*Downloader) DeliverChunk ¶ added in v0.9.17
func (d *Downloader) DeliverChunk(id string, blocks []*types.Block)
Deliver a chunk to the downloader. This is usually done through the BlocksMsg by the protocol handler.
func (*Downloader) RegisterPeer ¶
func (d *Downloader) RegisterPeer(id string, hash common.Hash, getHashes hashFetcherFn, getBlocks blockFetcherFn) error
func (*Downloader) Stats ¶ added in v0.9.17
func (d *Downloader) Stats() (current int, max int)
func (*Downloader) Synchronise ¶
func (d *Downloader) Synchronise(id string, hash common.Hash) error
Synchronise will select the peer and use it for synchronising. If an empty string is given it will use the best peer possible and synchronize if it's TD is higher than our own. If any of the checks fail an error will be returned. This method is synchronous
func (*Downloader) TakeBlocks ¶ added in v0.9.17
func (d *Downloader) TakeBlocks() types.Blocks
TakeBlocks takes blocks from the queue and yields them to the blockTaker handler it's possible it yields no blocks
func (*Downloader) UnregisterPeer ¶
func (d *Downloader) UnregisterPeer(id string)
UnregisterPeer unregisters a peer. This will prevent any action from the specified peer.
Click to show internal directories.
Click to hide internal directories.