Documentation ¶
Index ¶
- Variables
- func NewDownloader(ctx context.Context, bc common.IBlockChain, network common.INetwork, ...) common.IDownloader
- type Downloader
- func (d *Downloader) Close() error
- func (d *Downloader) ConnHandler(data []byte, ID peer.ID) error
- func (d *Downloader) FindBlock(number uint64, peerID peer.ID) (uint64, error)
- func (d *Downloader) IsDownloading() bool
- func (d *Downloader) Start() error
- func (d *Downloader) SyncBody() error
- func (d *Downloader) SyncHeader() error
- func (d *Downloader) SyncTx() error
- type Request
- type Response
- type SyncMode
- type Task
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBusy = fmt.Errorf("busy") ErrCanceled = fmt.Errorf("syncing canceled (requested)") ErrSyncBlock = fmt.Errorf("err sync block") ErrTimeout = fmt.Errorf("timeout") ErrBadPeer = fmt.Errorf("bad peer error") ErrNoPeers = fmt.Errorf("no peers to download") ErrInvalidPubSub = fmt.Errorf("PubSub is nil") )
Functions ¶
func NewDownloader ¶
Types ¶
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
func (*Downloader) Close ¶
func (d *Downloader) Close() error
func (*Downloader) ConnHandler ¶
func (d *Downloader) ConnHandler(data []byte, ID peer.ID) error
func (*Downloader) IsDownloading ¶
func (d *Downloader) IsDownloading() bool
func (*Downloader) SyncBody ¶
func (d *Downloader) SyncBody() error
func (*Downloader) SyncHeader ¶
func (d *Downloader) SyncHeader() error
func (*Downloader) SyncTx ¶
func (d *Downloader) SyncTx() error
type Response ¶
type Response struct { Req *request // Original request to cross-reference with Res interface{} // Remote response for the request query Meta interface{} // Metadata generated locally on the receiver thread Time time.Duration // Time it took for the request to be served Done chan error // Channel to signal message handling to the reader // contains filtered or unexported fields }
type SyncMode ¶
type SyncMode uint32
SyncMode represents the synchronisation mode of the downloader. It is a uint32 as it is used with atomic operations.
func (SyncMode) MarshalText ¶
func (*SyncMode) UnmarshalText ¶
Click to show internal directories.
Click to hide internal directories.