message

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitSwapMessage

type BitSwapMessage interface {
	// Wantlist returns a slice of unique keys that represent data wanted by
	// the sender.
	Wantlist() []Entry

	// Blocks returns a slice of unique blocks.
	Blocks() []blocks.Block

	// Ticks returns a slice of tickets.
	Tickets() []tickets.Ticket //TODO: add definitions - Jerry

	TicketAcks() []tickets.TicketAck

	// AddEntry adds an entry to the Wantlist.
	AddEntry(key cid.Cid, priority int)

	Cancel(key cid.Cid)

	Empty() bool

	// A full wantlist is an authoritative copy, a 'non-full' wantlist is a patch-set
	Full() bool

	AddBlock(blocks.Block)

	AddTicket(tickets.Ticket)
	AddTickets([]tickets.Ticket)

	AddTicketAck(tickets.TicketAck)
	AddTicketAcks([]tickets.TicketAck)
	Exportable

	Loggable() map[string]interface{}
}

BitSwapMessage is the basic interface for interacting building, encoding, and decoding messages sent on the BitSwap protocol.

func FromMsgReader

func FromMsgReader(r msgio.Reader) (BitSwapMessage, error)

FromPBReader generates a new Bitswap message from a gogo-protobuf reader

func FromNet

func FromNet(r io.Reader) (BitSwapMessage, error)

FromNet generates a new BitswapMessage from incoming data on an io.Reader.

func New

func New(full bool) BitSwapMessage

New returns a new, empty bitswap message

type Entry

type Entry struct {
	wantlist.Entry
	Cancel bool
}

Entry is an wantlist entry in a Bitswap message (along with whether it's an add or cancel).

type Exportable

type Exportable interface {
	ToProtoV0() *pb.Message
	ToProtoV1() *pb.Message
	ToNetV0(w io.Writer) error
	ToNetV1(w io.Writer) error
}

Exportable is an interface for structures than can be encoded in a bitswap protobuf.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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