network

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: Apache-2.0, MIT Imports: 17 Imported by: 27

Documentation

Index

Constants

View Source
const TagPriority = 100

TagPriority is the priority for deal streams -- they should generally be preserved above all else

Variables

View Source
var AskRequestUndefined = AskRequest{}
View Source
var AskResponseUndefined = AskResponse{}
View Source
var ProposalUndefined = Proposal{}
View Source
var SignedResponseUndefined = SignedResponse{}

Functions

This section is empty.

Types

type AskRequest

type AskRequest struct {
	Miner address.Address
}

AskRequest is a request for current ask parameters for a given miner

func (*AskRequest) MarshalCBOR

func (t *AskRequest) MarshalCBOR(w io.Writer) error

func (*AskRequest) UnmarshalCBOR

func (t *AskRequest) UnmarshalCBOR(r io.Reader) error

type AskResponse

type AskResponse struct {
	Ask *storagemarket.SignedStorageAsk
}

AskResponse is the response sent over the network in response to an ask request

func (*AskResponse) MarshalCBOR

func (t *AskResponse) MarshalCBOR(w io.Writer) error

func (*AskResponse) UnmarshalCBOR

func (t *AskResponse) UnmarshalCBOR(r io.Reader) error

type Proposal

type Proposal struct {
	DealProposal *market.ClientDealProposal

	Piece *storagemarket.DataRef
}

Proposal is the data sent over the network from client to provider when proposing a deal

func (*Proposal) MarshalCBOR

func (t *Proposal) MarshalCBOR(w io.Writer) error

func (*Proposal) UnmarshalCBOR

func (t *Proposal) UnmarshalCBOR(r io.Reader) error

type Response

type Response struct {
	State storagemarket.StorageDealStatus

	// DealProposalRejected
	Message  string
	Proposal cid.Cid

	// StorageDealProposalAccepted
	PublishMessage *cid.Cid
}

Response is a response to a proposal sent over the network

func (*Response) MarshalCBOR

func (t *Response) MarshalCBOR(w io.Writer) error

func (*Response) UnmarshalCBOR

func (t *Response) UnmarshalCBOR(r io.Reader) error

type SignedResponse

type SignedResponse struct {
	Response Response

	Signature *crypto.Signature
}

SignedResponse is a response that is signed

func (*SignedResponse) MarshalCBOR

func (t *SignedResponse) MarshalCBOR(w io.Writer) error

func (*SignedResponse) UnmarshalCBOR

func (t *SignedResponse) UnmarshalCBOR(r io.Reader) error

type StorageAskStream

type StorageAskStream interface {
	ReadAskRequest() (AskRequest, error)
	WriteAskRequest(AskRequest) error
	ReadAskResponse() (AskResponse, error)
	WriteAskResponse(AskResponse) error
	Close() error
}

StorageAskStream is a stream for reading/writing requests & responses on the Storage Ask protocol

type StorageDealStream

type StorageDealStream interface {
	ReadDealProposal() (Proposal, error)
	WriteDealProposal(Proposal) error
	ReadDealResponse() (SignedResponse, error)
	WriteDealResponse(SignedResponse) error
	RemotePeer() peer.ID
	TagProtectedConnection(identifier string)
	UntagProtectedConnection(identifier string)
	Close() error
}

StorageDealStream is a stream for reading and writing requests and responses on the storage deal protocol

type StorageMarketNetwork

type StorageMarketNetwork interface {
	NewAskStream(peer.ID) (StorageAskStream, error)
	NewDealStream(peer.ID) (StorageDealStream, error)
	SetDelegate(StorageReceiver) error
	StopHandlingRequests() error
	ID() peer.ID
}

StorageMarketNetwork is a network abstraction for the storage market

func NewFromLibp2pHost

func NewFromLibp2pHost(h host.Host) StorageMarketNetwork

NewFromLibp2pHost builds a storage market network on top of libp2p

type StorageReceiver

type StorageReceiver interface {
	HandleAskStream(StorageAskStream)
	HandleDealStream(StorageDealStream)
}

StorageReceiver implements functions for receiving incoming data on storage protocols

Jump to

Keyboard shortcuts

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