retrieval

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2019 License: Apache-2.0, MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Accepted = iota
	Error
	Rejected
	Unsealing
)
View Source
const ProtocolID = "/fil/retrieval/-1.0.0" // TODO: spec
View Source
const QueryProtocolID = "/fil/retrieval/qry/-1.0.0" // TODO: spec

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Prefix []byte // TODO: fix cid.Prefix marshaling somehow
	Data   []byte
}

func (*Block) MarshalCBOR

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

func (*Block) UnmarshalCBOR

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

type BlockVerifier

type BlockVerifier interface {
	Verify(context.Context, blocks.Block, io.Writer) (internal bool, err error)
}

type Client

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

func NewClient

func NewClient(h host.Host, pmgr *paych.Manager, payapi payapi.PaychAPI) *Client

func (*Client) Query

func (c *Client) Query(ctx context.Context, p discovery.RetrievalPeer, data cid.Cid) api.QueryOffer

func (*Client) RetrieveUnixfs

func (c *Client) RetrieveUnixfs(ctx context.Context, root cid.Cid, size uint64, total types.BigInt, miner peer.ID, client, minerAddr address.Address, out io.Writer) error

C > S

Offset MUST be aligned on chunking boundaries, size is rounded up to leaf size

> DealProposal{Mode: Unixfs0, RootCid, Offset, Size, Payment(nil if free)} < Resp{Accept} < ..(Intermediate Block) < ..Blocks < ..(Intermediate Block) < ..Blocks > DealProposal(...) < ...

type DealProposal

type DealProposal struct {
	Payment api.PaymentInfo

	Ref    cid.Cid
	Params RetParams
}

func (*DealProposal) MarshalCBOR

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

func (*DealProposal) UnmarshalCBOR

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

type DealResponse

type DealResponse struct {
	Status  uint64
	Message string
}

func (*DealResponse) MarshalCBOR

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

func (*DealResponse) UnmarshalCBOR

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

type Miner

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

func NewMiner

func NewMiner(sblks *sectorblocks.SectorBlocks, full api.FullNode) *Miner

func (*Miner) HandleDealStream

func (m *Miner) HandleDealStream(stream network.Stream)

func (*Miner) HandleQueryStream

func (m *Miner) HandleQueryStream(stream network.Stream)

type OptimisticVerifier

type OptimisticVerifier struct {
}

func (*OptimisticVerifier) Verify

type Query

type Query struct {
	Piece cid.Cid
}

func (*Query) MarshalCBOR

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

func (*Query) UnmarshalCBOR

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

type QueryResponse

type QueryResponse struct {
	Status QueryResponseStatus

	Size uint64 // TODO: spec
	// TODO: unseal price (+spec)
	// TODO: sectors to unseal
	// TODO: address to send money for the deal?
	MinPrice types.BigInt
}

func (*QueryResponse) MarshalCBOR

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

func (*QueryResponse) UnmarshalCBOR

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

type QueryResponseStatus

type QueryResponseStatus uint64
const (
	Available QueryResponseStatus = iota
	Unavailable
)

type RetParams

type RetParams struct {
	Unixfs0 *Unixfs0Offer
}

func (*RetParams) MarshalCBOR

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

func (*RetParams) UnmarshalCBOR

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

type RetrMinerApi

type RetrMinerApi interface {
	PaychVoucherAdd(context.Context, address.Address, *types.SignedVoucher, []byte, types.BigInt) (types.BigInt, error)
}

type UnixFs0Verifier

type UnixFs0Verifier struct {
	Root cid.Cid
	// contains filtered or unexported fields
}

func (*UnixFs0Verifier) Verify

func (b *UnixFs0Verifier) Verify(ctx context.Context, blk blocks.Block, w io.Writer) (bool, error)

type Unixfs0Offer

type Unixfs0Offer struct {
	Offset uint64
	Size   uint64
}

func (*Unixfs0Offer) MarshalCBOR

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

func (*Unixfs0Offer) UnmarshalCBOR

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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