Documentation ¶
Index ¶
- type PacksDownloader
- func (d *PacksDownloader) OnNewEpoch(myEpoch idx.Epoch, peerEpoch func(string) idx.Epoch)
- func (d *PacksDownloader) Peer(peer string) *PeerPacksDownloader
- func (d *PacksDownloader) PeersNum() int
- func (d *PacksDownloader) RegisterPeer(peer Peer, myEpoch idx.Epoch) error
- func (d *PacksDownloader) Terminate()
- func (d *PacksDownloader) UnregisterPeer(peer string) error
- type Peer
- type PeerPacksDownloader
- func (d *PeerPacksDownloader) NotifyPack(epoch idx.Epoch, index idx.Pack, ids hash.Events, time time.Time, ...) error
- func (d *PeerPacksDownloader) NotifyPackInfo(epoch idx.Epoch, index idx.Pack, heads hash.Events, time time.Time) error
- func (d *PeerPacksDownloader) NotifyPacksNum(epoch idx.Epoch, packsNum idx.Pack) error
- func (d *PeerPacksDownloader) Start()
- func (d *PeerPacksDownloader) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PacksDownloader ¶
type PacksDownloader struct {
// contains filtered or unexported fields
}
PacksDownloader is responsible for accumulating pack announcements from various peers and scheduling them for retrieval.
func New ¶
func New(fetcher *fetcher.Fetcher, onlyNotConnected onlyNotConnectedFn, dropPeer dropPeerFn) *PacksDownloader
New creates a packs fetcher to retrieve events based on pack announcements.
func (*PacksDownloader) OnNewEpoch ¶
func (*PacksDownloader) Peer ¶
func (d *PacksDownloader) Peer(peer string) *PeerPacksDownloader
func (*PacksDownloader) PeersNum ¶
func (d *PacksDownloader) PeersNum() int
func (*PacksDownloader) RegisterPeer ¶
func (d *PacksDownloader) RegisterPeer(peer Peer, myEpoch idx.Epoch) error
RegisterPeer injects a new download peer into the set of block source to be used for fetching hashes and blocks from.
func (*PacksDownloader) Terminate ¶
func (d *PacksDownloader) Terminate()
Terminate interrupts the downloader, canceling all pending operations. The downloader cannot be reused after calling Terminate.
func (*PacksDownloader) UnregisterPeer ¶
func (d *PacksDownloader) UnregisterPeer(peer string) error
UnregisterPeer removes a peer from the known list, preventing any action from the specified peer. An effort is also made to return any pending fetches into the queue.
type PeerPacksDownloader ¶
type PeerPacksDownloader struct {
// contains filtered or unexported fields
}
PeerPacksDownloader is responsible for accumulating pack announcements from various peers and scheduling them for retrieval.
func (*PeerPacksDownloader) NotifyPack ¶
func (d *PeerPacksDownloader) NotifyPack(epoch idx.Epoch, index idx.Pack, ids hash.Events, time time.Time, fetchEvents fetcher.EventsRequesterFn) error
NotifyPack injects new packs from a peer
func (*PeerPacksDownloader) NotifyPackInfo ¶
func (d *PeerPacksDownloader) NotifyPackInfo(epoch idx.Epoch, index idx.Pack, heads hash.Events, time time.Time) error
NotifyPackInfo injects new pack infos from a peer
func (*PeerPacksDownloader) NotifyPacksNum ¶
NotifyPacksNum injects new packs num from a peer
func (*PeerPacksDownloader) Start ¶
func (d *PeerPacksDownloader) Start()
Start boots up the announcement based synchroniser, accepting and processing hash notifications and event fetches until termination requested.
func (*PeerPacksDownloader) Stop ¶
func (d *PeerPacksDownloader) Stop()
Stop terminates the announcement based synchroniser, canceling all pending operations.