bvstreamleecher

package
v0.0.0-...-34d0e24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BVsID

type BVsID struct {
	Epoch     idx.Epoch
	LastBlock idx.Block
	ID        hash.Event
}

type Callbacks

type Callbacks struct {
	LowestBlockToDecide func() (idx.Epoch, idx.Block)
	MaxEpochToDecide    func() idx.Epoch
	IsProcessed         func(epoch idx.Epoch, lastBlock idx.Block, id hash.Event) bool

	RequestChunk func(peer string, r bvstream.Request) error
	Suspend      func(peer string) bool
	PeerBlock    func(peer string) idx.Block
}

type Config

type Config struct {
	Session              basepeerleecher.EpochDownloaderConfig
	RecheckInterval      time.Duration
	BaseProgressWatchdog time.Duration
	BaseSessionWatchdog  time.Duration
	MinSessionRestart    time.Duration
	MaxSessionRestart    time.Duration
}

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns default leecher config

func LiteConfig

func LiteConfig() Config

LiteConfig returns default leecher config for tests

type Leecher

type Leecher struct {
	*basestreamleecher.BaseLeecher
	// contains filtered or unexported fields
}

Leecher is responsible for requesting BVs based on lexicographic BVs streams

func New

func New(cfg Config, callback Callbacks) *Leecher

New creates an BVs downloader to request BVs based on lexicographic BVs streams

func (*Leecher) ForceSyncing

func (d *Leecher) ForceSyncing()

func (*Leecher) NotifyChunkReceived

func (d *Leecher) NotifyChunkReceived(sessionID uint32, lastID BVsID, done bool) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL