basestreamseeder

package
v0.1.5 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: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSelectorMismatch = errors.New("session selector mismatch")
	ErrTooManyChunks    = errors.New("too many request chunks")
)

Functions

This section is empty.

Types

type BaseSeeder

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

func New

func New(cfg Config, callbacks Callbacks) *BaseSeeder

func (*BaseSeeder) NotifyRequestReceived

func (s *BaseSeeder) NotifyRequestReceived(peer Peer, r basestream.Request) (err error, peerErr error)

func (*BaseSeeder) Start

func (s *BaseSeeder) Start()

func (*BaseSeeder) Stop

func (s *BaseSeeder) Stop()

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

func (*BaseSeeder) UnregisterPeer

func (s *BaseSeeder) UnregisterPeer(peer string) error

type Callbacks

type Callbacks struct {
	ForEachItem func(start basestream.Locator, rType basestream.RequestType, onKey func(key basestream.Locator) bool, onAppended func(items basestream.Payload) bool) basestream.Payload
}

type Config

type Config struct {
	SenderThreads           int
	MaxSenderTasks          int
	MaxPendingResponsesSize int64
	MaxResponsePayloadNum   uint32
	MaxResponsePayloadSize  uint64
	MaxResponseChunks       uint32
}

type Peer

type Peer struct {
	ID           string
	SendChunk    func(basestream.Response) error
	Misbehaviour func(error)
}

Jump to

Keyboard shortcuts

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