pushsync

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: BSD-3-Clause Imports: 22 Imported by: 4

Documentation

Overview

Package pushsync provides the pushsync protocol implementation.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPush            = errors.New("could not push chunk")
	ErrOutOfDepthStoring = errors.New("storing outside of the neighborhood")
	ErrWarmup            = errors.New("node warmup time not complete")
)

Functions

This section is empty.

Types

type PushSync

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

func New

func New(
	address swarm.Address,
	nonce []byte,
	streamer p2p.StreamerDisconnecter,
	store Storer,
	topology topology.Driver,
	fullNode bool,
	unwrap func(swarm.Chunk),
	validStamp postage.ValidStampFn,
	logger log.Logger,
	accounting accounting.Interface,
	pricer pricer.Interface,
	signer crypto.Signer,
	tracer *tracing.Tracer,
	warmupTime time.Duration,
) *PushSync

func (*PushSync) Close added in v1.15.0

func (s *PushSync) Close() error

func (*PushSync) Metrics

func (s *PushSync) Metrics() []prometheus.Collector

func (*PushSync) Protocol

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

func (*PushSync) PushChunkToClosest

func (ps *PushSync) PushChunkToClosest(ctx context.Context, ch swarm.Chunk) (*Receipt, error)

PushChunkToClosest sends chunk to the closest peer by opening a stream. It then waits for a receipt from that peer and returns error or nil based on the receiving and the validity of the receipt.

type PushSyncer

type PushSyncer interface {
	PushChunkToClosest(ctx context.Context, ch swarm.Chunk) (*Receipt, error)
}

type Receipt

type Receipt struct {
	Address   swarm.Address
	Signature []byte
	Nonce     []byte
}

type Storer added in v1.17.0

type Storer interface {
	storage.PushReporter
	ReservePutter() storage.Putter
	IsWithinStorageRadius(swarm.Address) bool
	StorageRadius() uint8
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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