streamleecher

package
v0.0.1-rc Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callbacks

type Callbacks struct {
	OnlyNotConnected peerleecher.OnlyNotConnectedFn

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

type Config

type Config struct {
	Session              peerleecher.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

DefaultConfig returns default leecher config for tests

type Leecher

type Leecher struct {
	// contains filtered or unexported fields
}

Leecher is responsible for requesting events based on lexicographic event streams

func New

func New(epoch idx.Epoch, emptyState bool, cfg Config, callback Callbacks) *Leecher

New creates an events downloader to request events based on lexicographic event streams

func (*Leecher) ForceSyncing

func (d *Leecher) ForceSyncing()

func (*Leecher) NotifyChunkReceived

func (d *Leecher) NotifyChunkReceived(sessionID uint32, last hash.Event, done bool) error

func (*Leecher) OnNewEpoch

func (d *Leecher) OnNewEpoch(myEpoch idx.Epoch)

func (*Leecher) PeersNum

func (d *Leecher) PeersNum() int

func (*Leecher) RegisterPeer

func (d *Leecher) RegisterPeer(peer string) error

RegisterPeer injects a new download peer to download epochs from.

func (*Leecher) Start

func (d *Leecher) Start()

func (*Leecher) Stop

func (d *Leecher) Stop()

Stop interrupts the leecher, canceling all the pending operations. Stop waits until all the internal goroutines have finished.

func (*Leecher) UnregisterPeer

func (d *Leecher) UnregisterPeer(peer string) error

UnregisterPeer removes a peer from the known list, preventing current or any future sessions with the peer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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