pushsync

package
v0.5.9-0...-ba7202b Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	// subscribe to chunk to be push synced - iterates from earliest to newest
	SubscribePush(context.Context) (<-chan storage.Chunk, func())
	// called to set a chunk as synced - and allow it to be garbage collected
	// TODO this should take ... last argument to delete many in one batch
	Set(context.Context, chunk.ModeSet, ...storage.Address) error
}

DB interface implemented by localstore

type PubSub

type PubSub interface {
	Register(topic string, prox bool, handler func(msg []byte, p *p2p.Peer) error) func()
	Send(to []byte, topic string, msg []byte) error
	BaseAddr() []byte
	IsClosestTo([]byte) bool
}

PubSub is a Postal Service interface needed to send/receive chunks and receipts for push syncing

type Pusher

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

Pusher takes care of the push syncing

func NewPusher

func NewPusher(store DB, ps PubSub, tags *chunk.Tags) *Pusher

NewPusher constructs a Pusher and starts up the push sync protocol takes - a DB interface to subscribe to push sync index to allow iterating over recently stored chunks - a pubsub interface to send chunks and receive statements of custody - tags that hold the tags

func (*Pusher) Close

func (p *Pusher) Close()

Close closes the pusher

type Store

type Store interface {
	Put(context.Context, chunk.ModePut, ...chunk.Chunk) ([]bool, error)
}

Store is the storage interface to save chunks NetStore implements this interface

type Storer

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

Storer is the object used by the push-sync server side protocol

func NewStorer

func NewStorer(store Store, ps PubSub) *Storer

NewStorer constructs a Storer Storer runs on storer nodes to handle the reception of push-synced chunks that fall within their area of responsibility. The protocol makes sure that - the chunks are stored and synced to their nearest neighbours and - a statement of custody receipt is sent as a response to the originator it sets a cancel function that deregisters the handler

func (*Storer) Close

func (s *Storer) Close()

Close needs to be called to deregister the handler

Jump to

Keyboard shortcuts

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