powergate: github.com/textileio/powergate/ffs/filcold Index | Files

package filcold

import "github.com/textileio/powergate/ffs/filcold"


Package Files


type FilChain Uses

type FilChain interface {
    GetHeight(context.Context) (uint64, error)

FilChain is an abstraction of a Filecoin node to get information of the network.

type FilCold Uses

type FilCold struct {
    // contains filtered or unexported fields

FilCold is a ColdStorage implementation which saves data in the Filecoin network. It assumes the underlying Filecoin client has access to an IPFS node where data is stored.

func New Uses

func New(ms ffs.MinerSelector, dm *dealsModule.Module, ipfs iface.CoreAPI, chain FilChain, l ffs.JobLogger, lsm *lotus.SyncMonitor, minPieceSize uint64, maxParallelDealPreparing int) *FilCold

New returns a new FilCold instance.

func (*FilCold) EnsureRenewals Uses

func (fc *FilCold) EnsureRenewals(ctx context.Context, c cid.Cid, inf ffs.FilInfo, cfg ffs.FilConfig, dealFinalityTimeout time.Duration, dealUpdates chan deals.StorageDealInfo) (ffs.FilInfo, []ffs.DealError, error)

EnsureRenewals analyzes a FilInfo state for a Cid and executes renewals considering the FilConfig desired configuration. Deal status updates are sent on the provided dealUpdates channel. The caller should close the channel once all calls to EnsureRenewals have returned. It returns an updated FilInfo for the Cid. All prevous Proposals in the received FilInfo are kept, only flagging the ones that got renewed with Renewed=true. New deals from renewals are added to the returned FilInfo. Note: Most probably all this code should change in the future, when Filecoin supports telling the miner which deal is about to expire that we're interested in extending the deal duration. Now we should make a new deal from scratch (send data, etc).

func (*FilCold) Fetch Uses

func (fc *FilCold) Fetch(ctx context.Context, pyCid cid.Cid, piCid *cid.Cid, waddr string, miners []string, maxPrice uint64, selector string) (ffs.FetchInfo, error)

Fetch fetches the stored Cid data.The data will be considered available to the underlying blockstore.

func (*FilCold) GetDealInfo Uses

func (fc *FilCold) GetDealInfo(ctx context.Context, dealID uint64) (api.MarketDeal, error)

GetDealInfo returns on-chain information for a deal.

func (*FilCold) Store Uses

func (fc *FilCold) Store(ctx context.Context, c cid.Cid, cfg ffs.FilConfig) ([]cid.Cid, []ffs.DealError, abi.PaddedPieceSize, error)

Store stores a Cid in Filecoin considering the configuration provided. The Cid is retrieved using the DAGService registered on instance creation. It returns a slice of ProposalCids that were correctly started, and a slice of with Proposal Cids rejected. Returned proposed deals can be tracked with the WaitForDeal API.

func (*FilCold) WaitForDeal Uses

func (fc *FilCold) WaitForDeal(ctx context.Context, c cid.Cid, proposal cid.Cid, timeout time.Duration, dealUpdates chan deals.StorageDealInfo) (ffs.FilStorage, error)

WaitForDeal blocks the provided Deal Proposal reaches a final state. Deal status updates are sent on the provided dealUpdates channel. The caller should close the channel once all calls to WaitForDeal have returned. If the deal finishes successfully it returns a FilStorage result. If the deal finished with error, it returns a ffs.DealError error result, so it should be considered in error handling.

Package filcold imports 16 packages (graph) and is imported by 4 packages. Updated 2021-01-28. Refresh now. Tools for package owners.