Documentation ¶
Index ¶
- type BeaconHelperConfig
- type Config
- type Downloader
- func (d *Downloader) Close()
- func (d *Downloader) DownloadAsync()
- func (d *Downloader) NumPeers() int
- func (d *Downloader) Start()
- func (d *Downloader) SubscribeDownloadFinished(ch chan struct{}) event.Subscription
- func (d *Downloader) SubscribeDownloadStarted(ch chan struct{}) event.Subscription
- func (d *Downloader) SyncStatus() (bool, uint64, uint64)
- type Downloaders
- func (ds *Downloaders) Close()
- func (ds *Downloaders) DownloadAsync(shardID uint32)
- func (ds *Downloaders) GetShardDownloader(shardID uint32) *Downloader
- func (ds *Downloaders) IsActive() bool
- func (ds *Downloaders) NumPeers() map[uint32]int
- func (ds *Downloaders) Start()
- func (ds *Downloaders) SyncStatus(shardID uint32) (bool, uint64, uint64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BeaconHelperConfig ¶
BeaconHelperConfig is the extra config used for beaconHelper which uses pub-sub block message to do sync.
type Config ¶
type Config struct { // Only run stream sync protocol as a server. // TODO: remove this when stream sync is fully up. ServerOnly bool // parameters Network nodeconfig.NetworkType Concurrency int // Number of concurrent sync requests MinStreams int // Minimum number of streams to do sync InitStreams int // Number of streams requirement for initial bootstrap // stream manager config SmSoftLowCap int SmHardLowCap int SmHiCap int SmDiscBatch int // config for beacon config BHConfig *BeaconHelperConfig }
Config is the downloader config
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
Downloader is responsible for sync task of one shard
func NewDownloader ¶
func NewDownloader(host p2p.Host, bc core.BlockChain, config Config) *Downloader
NewDownloader creates a new downloader
func (*Downloader) DownloadAsync ¶
func (d *Downloader) DownloadAsync()
DownloadAsync triggers the download async.
func (*Downloader) NumPeers ¶
func (d *Downloader) NumPeers() int
NumPeers returns the number of peers connected of a specific shard.
func (*Downloader) SubscribeDownloadFinished ¶
func (d *Downloader) SubscribeDownloadFinished(ch chan struct{}) event.Subscription
SubscribeDownloadFinished subscribe the download finished
func (*Downloader) SubscribeDownloadStarted ¶
func (d *Downloader) SubscribeDownloadStarted(ch chan struct{}) event.Subscription
SubscribeDownloadStarted subscribe download started
func (*Downloader) SyncStatus ¶
func (d *Downloader) SyncStatus() (bool, uint64, uint64)
IsSyncing return the current sync status
type Downloaders ¶
type Downloaders struct {
// contains filtered or unexported fields
}
Downloaders is the set of downloaders
func NewDownloaders ¶
func NewDownloaders(host p2p.Host, bcs []core.BlockChain, config Config) *Downloaders
NewDownloaders creates Downloaders for sync of multiple blockchains
func (*Downloaders) DownloadAsync ¶
func (ds *Downloaders) DownloadAsync(shardID uint32)
DownloadAsync triggers a download
func (*Downloaders) GetShardDownloader ¶
func (ds *Downloaders) GetShardDownloader(shardID uint32) *Downloader
GetShardDownloader get the downloader with the given shard ID
func (*Downloaders) IsActive ¶
func (ds *Downloaders) IsActive() bool
IsActive returns whether the downloader is active
func (*Downloaders) NumPeers ¶
func (ds *Downloaders) NumPeers() map[uint32]int
NumPeers returns the connected peers for each shard
func (*Downloaders) SyncStatus ¶
func (ds *Downloaders) SyncStatus(shardID uint32) (bool, uint64, uint64)
SyncStatus returns whether the given shard is doing syncing task and the target block number.