storagemarket

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: Apache-2.0, MIT Imports: 53 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// DealCancelled means that a deal has been cancelled by the caller
	DealCancelled = "Cancelled"
)
View Source
const DealMaxLabelSize = 256

Variables

View Source
var (
	ErrDealNotFound        = fmt.Errorf("deal not found")
	ErrDealHandlerNotFound = errors.New("deal handler not found")
)

Functions

func GenerateCommP

func GenerateCommP(filepath string) (cidAndSize *writer.DataCIDSize, finalErr error)

GenerateCommP

func GeneratePieceCommitment

func GeneratePieceCommitment(filepath string, dealSize abi.PaddedPieceSize) (c cid.Cid, finalErr error)

GeneratePieceCommitment generates the pieceCid for the CARv1 deal payload in the CARv2 file that already exists at the given path.

Types

type ChainDealManager

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

func NewChainDealManager

func NewChainDealManager(a v1api.FullNode, cfg ChainDealManagerCfg) *ChainDealManager

func (*ChainDealManager) CheckDealEquality

func (c *ChainDealManager) CheckDealEquality(ctx context.Context, tok ctypes.TipSetKey, p1, p2 market.DealProposal) (bool, error)

func (*ChainDealManager) GetCurrentDealInfo

func (c *ChainDealManager) GetCurrentDealInfo(ctx context.Context, tok ctypes.TipSetKey, proposal *market.DealProposal, publishCid cid.Cid) (CurrentDealInfo, error)

GetCurrentDealInfo gets the current deal state and deal ID. Note that the deal ID is assigned when the deal is published, so it may have changed if there was a reorg after the deal was published.

func (*ChainDealManager) WaitForPublishDeals

func (c *ChainDealManager) WaitForPublishDeals(ctx context.Context, publishCid cid.Cid, proposal market2.DealProposal) (*storagemarket.PublishDealsWaitResult, error)

type ChainDealManagerCfg

type ChainDealManagerCfg struct {
	PublishDealsConfidence uint64
}

type Config

type Config struct {
	MaxTransferDuration time.Duration
}

type CurrentDealInfo

type CurrentDealInfo struct {
	DealID           abi.DealID
	MarketDeal       *api.MarketDeal
	PublishMsgTipSet ctypes.TipSetKey
}

type Provider

type Provider struct {

	// Address of the provider on chain.
	Address address.Address

	Transport transport.Transport
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(sqldb *sql.DB, dealsDB *db.DealsDB, fundMgr *fundmanager.FundManager, storageMgr *storagemanager.StorageManager, fullnodeApi v1api.FullNode, dp types.DealPublisher, addr address.Address, pa types.PieceAdder,
	sps sealingpipeline.API, cm types.ChainDealManager, df dtypes.StorageDealFilter, logsSqlDB *sql.DB, logsDB *db.LogsDB,
	dagst stores.DAGStoreWrapper, ps piecestore.PieceStore, ip types.IndexProvider, askGetter types.AskGetter,
	sigVerifier types.SignatureVerifier, dl *logs.DealLogger, tspt transport.Transport) (*Provider, error)

func (*Provider) AddPieceToSector

func (p *Provider) AddPieceToSector(ctx context.Context, deal smtypes.ProviderDealState, pieceData io.Reader) (*storagemarket.PackingResult, error)

func (*Provider) CancelDealDataTransfer

func (p *Provider) CancelDealDataTransfer(dealUuid uuid.UUID) error

func (*Provider) Deal

func (p *Provider) Deal(ctx context.Context, dealUuid uuid.UUID) (*types.ProviderDealState, error)

func (*Provider) ExecuteDeal

func (p *Provider) ExecuteDeal(dp *types.DealParams, clientPeer peer.ID) (*api.ProviderDealRejectionInfo, error)

ExecuteDeal is called when the Storage Provider receives a deal proposal from the network

func (*Provider) FailPausedDeal

func (p *Provider) FailPausedDeal(dealUuid uuid.UUID) error

FailPausedDeal moves a deal from the paused state to the failed state

func (*Provider) GetAsk

func (*Provider) GetBalance

func (p *Provider) GetBalance(ctx context.Context, addr address.Address, encodedTs shared.TipSetToken) (storagemarket.Balance, error)

func (*Provider) ImportOfflineDealData

func (p *Provider) ImportOfflineDealData(dealUuid uuid.UUID, filePath string) (pi *api.ProviderDealRejectionInfo, err error)

ImportOfflineDealData is called when the Storage Provider imports data for an offline deal (the deal must already have been proposed by the client)

func (*Provider) NBytesReceived

func (p *Provider) NBytesReceived(dealUuid uuid.UUID) uint64

func (*Provider) RetryPausedDeal

func (p *Provider) RetryPausedDeal(dealUuid uuid.UUID) error

RetryPausedDeal starts execution of a deal from the point at which it stopped

func (*Provider) Start

func (p *Provider) Start() error

func (*Provider) Stop

func (p *Provider) Stop()

func (*Provider) SubscribeDealUpdates

func (p *Provider) SubscribeDealUpdates(dealUuid uuid.UUID) (event.Subscription, error)

SubscribeDealUpdates subscribes to updates to a deal

func (*Provider) SubscribeNewDeals

func (p *Provider) SubscribeNewDeals() (event.Subscription, error)

SubscribeNewDeals subscribes to "new deal" events

func (*Provider) Transfers

func (p *Provider) Transfers() map[uuid.UUID][]transferPoint

Transfers returns a map of active transfers, sampled for up to 60s

Directories

Path Synopsis
mock_types
Package mock_types is a generated GoMock package.
Package mock_types is a generated GoMock package.

Jump to

Keyboard shortcuts

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