retrieval

package
Version: v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPeerFound = errors.New("no peer found")
)

Functions

This section is empty.

Types

type ChunkDelivery

type ChunkDelivery struct {
	Ruid  uint
	Addr  storage.Address
	SData []byte
}

ChunkDelivery is the protocol msg for delivering a solicited chunk to a peer

func (*ChunkDelivery) Price added in v0.5.0

func (cd *ChunkDelivery) Price() *protocols.Price

Price is the method through which a message type marks itself as implementing the protocols.Price protocol and thus as swap-enabled message

type Peer

type Peer struct {
	*network.BzzPeer
	// contains filtered or unexported fields
}

Peer wraps BzzPeer with a contextual logger and tracks open retrievals for that peer

func NewPeer

func NewPeer(peer *network.BzzPeer, baseKey *network.BzzAddr) *Peer

NewPeer is the constructor for Peer

type Retrieval

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

Retrieval holds state and handles protocol messages for the `bzz-retrieve` protocol

func New

func New(kad *network.Kademlia, ns *storage.NetStore, baseKey *network.BzzAddr, balance protocols.Balance) *Retrieval

New returns a new instance of the retrieval protocol handler

func (*Retrieval) APIs

func (r *Retrieval) APIs() []rpc.API

func (*Retrieval) Protocols

func (r *Retrieval) Protocols() []p2p.Protocol

func (*Retrieval) RequestFromPeers

func (r *Retrieval) RequestFromPeers(ctx context.Context, req *storage.Request, localID enode.ID) (*enode.ID, func(), error)

RequestFromPeers sends a chunk retrieve request to the next found peer. returns the next peer to try, a cleanup function to expire retrievals that were never delivered

func (*Retrieval) Run

func (r *Retrieval) Run(bp *network.BzzPeer) error

Run is being dispatched when 2 nodes connect

func (*Retrieval) Spec added in v0.5.0

func (r *Retrieval) Spec() *protocols.Spec

func (*Retrieval) Start

func (r *Retrieval) Start(server *p2p.Server) error

func (*Retrieval) Stop

func (r *Retrieval) Stop() error

type RetrieveRequest

type RetrieveRequest struct {
	Ruid uint
	Addr storage.Address
}

RetrieveRequest is the protocol msg for chunk retrieve requests

func (*RetrieveRequest) Price added in v0.5.0

func (rr *RetrieveRequest) Price() *protocols.Price

Price is the method through which a message type marks itself as implementing the protocols.Price protocol and thus as swap-enabled message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL