shared

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: Apache-2.0, MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ResponseProtocolID core.ProtocolID = "/fil/secondary-retrieval/response/0.0.1"
View Source
var RetrievalProtocolID core.ProtocolID = "/fil/secondary-retrieval/0.0.1"

Functions

func StringToAddrInfo

func StringToAddrInfo(s string) (peer.AddrInfo, error)

StringToAddrInfo converts a multiaddress string with peer ID to AddrInfo

func StringsToAddrInfos

func StringsToAddrInfos(peers []string) ([]peer.AddrInfo, error)

StringsToAddrInfos converts an array of multiaddress strings to AddrInfos

Types

type Params

type Params struct {
	PayloadCID cid.Cid
	PieceCID   *cid.Cid
}

Params is the query parameters

func (*Params) Marshal

func (p *Params) Marshal() ([]byte, error)

Marshal returns the JSON marshalled Params

func (*Params) MustString

func (p *Params) MustString() string

MustString returns Params as a string It panics if it fails to marshal the Params

type Query

type Query struct {
	Params      Params   `json:"params"`      // Requested data
	ClientAddrs []string `json:"clientAddrs"` // List of multiaddrs of the client
}

Query is submitted by clients and observed by providers

func (*Query) Marshal

func (q *Query) Marshal() ([]byte, error)

Marshal returns the JSON marshalled Query

func (*Query) Unmarshal

func (q *Query) Unmarshal(bz []byte) error

Unmarshal JSON unmarshals the input into a Query

type QueryResponse

type QueryResponse struct {
	Params Params `json:"params"` // Requested data
	// TODO: Do we need their FIL address as well?
	Provider                peer.ID         `json:"provider"` // List of multiaddrs of the provider
	PricePerByte            abi.TokenAmount `json:"pricePerByte"`
	PaymentInterval         uint64          `json:"paymentInterval"`
	PaymentIntervalIncrease uint64          `json:"paymentIntervalIncrease"`
}

QueryResponse is returned from a provider to a client if the provider has the requested data

func (*QueryResponse) Marshal

func (q *QueryResponse) Marshal() ([]byte, error)

Marshal returns the JSON marshalled QueryResponse

func (*QueryResponse) String

func (q *QueryResponse) String() string

func (*QueryResponse) Unmarshal

func (q *QueryResponse) Unmarshal(bz []byte) error

Unmarshal JSON unmarshals the input into a QueryResponse

Jump to

Keyboard shortcuts

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