pullsync

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: BSD-3-Clause Imports: 16 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsolicitedChunk = errors.New("peer sent unsolicited chunk")
)

Functions

This section is empty.

Types

type Interface

type Interface interface {
	SyncInterval(ctx context.Context, peer swarm.Address, bin uint8, from, to uint64) (topmost uint64, ruid uint32, err error)
	GetCursors(ctx context.Context, peer swarm.Address) ([]uint64, error)
	CancelRuid(peer swarm.Address, ruid uint32) error
}

type Options

type Options struct {
	Streamer p2p.Streamer
	Storage  pullstorage.Storer

	Logger logging.Logger
}

type Syncer

type Syncer struct {
	Interface
	io.Closer
	// contains filtered or unexported fields
}

func New

func New(o Options) *Syncer

func (*Syncer) CancelRuid

func (s *Syncer) CancelRuid(peer swarm.Address, ruid uint32) error

func (*Syncer) Close

func (s *Syncer) Close() error

func (*Syncer) GetCursors

func (s *Syncer) GetCursors(ctx context.Context, peer swarm.Address) ([]uint64, error)

func (*Syncer) Protocol

func (s *Syncer) Protocol() p2p.ProtocolSpec

func (*Syncer) SyncInterval

func (s *Syncer) SyncInterval(ctx context.Context, peer swarm.Address, bin uint8, from, to uint64) (topmost uint64, ruid uint32, err error)

SyncInterval syncs a requested interval from the given peer. It returns the BinID of highest chunk that was synced from the given interval. If the requested interval is too large, the downstream peer has the liberty to provide less chunks than requested.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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