powergate: github.com/textileio/powergate/deals/module Index | Files

package module

import "github.com/textileio/powergate/deals/module"

Index

Package Files

deals.go store.go

Variables

var (
    // ErrRetrievalNoAvailableProviders indicates that the data isn't available on any provided
    // to be retrieved.
    ErrRetrievalNoAvailableProviders = errors.New("no providers to retrieve the data")
    // ErrDealNotFound indicates a particular ProposalCid from a deal isn't found on-chain. Currently,
    // in Lotus this indicates that it may never existed on-chain, or it existed but it already expired
    // (currEpoch > StartEpoch+Duration).
    ErrDealNotFound = errors.New("deal not found on-chain")
)
var (

    // ErrNotFound indicates the instance doesn't exist.
    ErrNotFound = errors.New("cid info not found")
)

type Module Uses

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

Module exposes storage and monitoring from the market.

func New Uses

func New(ds datastore.TxnDatastore, clientBuilder lotus.ClientBuilder, opts ...deals.Option) (*Module, error)

New creates a new Module.

func (*Module) Fetch Uses

func (m *Module) Fetch(ctx context.Context, waddr string, payloadCid cid.Cid, pieceCid *cid.Cid, miners []string) (string, <-chan marketevents.RetrievalEvent, error)

Fetch fetches deal data to the underlying blockstore of the Filecoin client. This API is meant for clients that use external implementations of blockstores with their own API, e.g: IPFS.

func (*Module) GetDealStatus Uses

func (m *Module) GetDealStatus(ctx context.Context, pcid cid.Cid) (storagemarket.StorageDealStatus, bool, error)

GetDealStatus returns the current status of the deal, and a flag indicating if the miner of the deal was slashed. If the deal doesn't exist, *or has expired* it will return ErrDealNotFound. There's not actual way of distinguishing both scenarios in Lotus.

func (*Module) Import Uses

func (m *Module) Import(ctx context.Context, data io.Reader, isCAR bool) (cid.Cid, int64, error)

Import imports raw data in the Filecoin client. The isCAR flag indicates if the data is already in CAR format, so it shouldn't be encoded into a UnixFS DAG in the Filecoin client. It returns the imported data cid and the data size.

func (*Module) ListRetrievalDealRecords Uses

func (m *Module) ListRetrievalDealRecords(opts ...deals.ListDealRecordsOption) ([]deals.RetrievalDealRecord, error)

ListRetrievalDealRecords returns a list of retrieval deals according to the provided options.

func (*Module) ListStorageDealRecords Uses

func (m *Module) ListStorageDealRecords(opts ...deals.ListDealRecordsOption) ([]deals.StorageDealRecord, error)

ListStorageDealRecords lists storage deals according to the provided options.

func (*Module) Retrieve Uses

func (m *Module) Retrieve(ctx context.Context, waddr string, payloadCid cid.Cid, pieceCid *cid.Cid, miners []string, CAREncoding bool) (string, io.ReadCloser, error)

Retrieve retrieves Deal data. It returns the miner address where the data is being fetched from, and a byte reader to read the retrieved data.

func (*Module) Store Uses

func (m *Module) Store(ctx context.Context, waddr string, dataCid cid.Cid, pieceSize uint64, dcfgs []deals.StorageDealConfig, minDuration uint64) ([]deals.StoreResult, error)

Store create Deal Proposals with all miners indicated in dcfgs. The epoch price is automatically calculated considering each miner epoch price and piece size. The data of dataCid should be already imported to the Filecoin Client or should be accessible to it. (e.g: is integrated with an IPFS node).

func (*Module) Watch Uses

func (m *Module) Watch(ctx context.Context, proposals []cid.Cid) (<-chan deals.StorageDealInfo, error)

Watch returns a channel with state changes of indicated proposals.

Package module imports 28 packages (graph) and is imported by 7 packages. Updated 2020-09-21. Refresh now. Tools for package owners.