brstreamleecher

package
v0.0.0-...-985cc99 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callbacks

type Callbacks struct {
	LowestBlockToFill func() idx.Block
	MaxBlockToFill    func() idx.Block
	IsProcessed       func(lastBlock idx.Block) bool

	RequestChunk func(peer string, r brstream.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 BRs based on lexicographic BRs streams

func New

func New(cfg Config, callback Callbacks) *Leecher

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

func (*Leecher) ForceSyncing

func (d *Leecher) ForceSyncing()

func (*Leecher) NotifyChunkReceived

func (d *Leecher) NotifyChunkReceived(sessionID uint32, lastBlock idx.Block, done bool) error

func (*Leecher) Pause

func (d *Leecher) Pause()

func (*Leecher) Resume

func (d *Leecher) Resume()

Jump to

Keyboard shortcuts

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