epstreamleecher

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 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 {
	LowestEpochToFetch func() idx.Epoch
	MaxEpochToFetch    func() idx.Epoch
	IsProcessed        func(idx.Epoch) bool

	RequestChunk func(peer string, r epstream.Request) error
	Suspend      func(peer string) bool
	PeerEpoch    func(peer string) idx.Epoch
}

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 EPs based on lexicographic EPs streams

func New

func New(cfg Config, callback Callbacks) *Leecher

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

func (*Leecher) ForceSyncing

func (d *Leecher) ForceSyncing()

func (*Leecher) NotifyChunkReceived

func (d *Leecher) NotifyChunkReceived(sessionID uint32, lastEpoch idx.Epoch, done bool) error

Jump to

Keyboard shortcuts

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