storagemarket

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: Apache-2.0, MIT Imports: 66 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
View Source
const OneGib = 1024 * 1024 * 1024

Variables

View Source
var (
	ErrDealNotFound        = fmt.Errorf("deal not found")
	ErrDealHandlerNotFound = errors.New("deal handler not found")
	ErrDealNotSealed       = errors.New("storage failed - deal not found in sector")
)
View Source
var DealClientABI = `` /* 5453-byte string literal not displayed */
View Source
var ErrCommpMismatch = fmt.Errorf("commp mismatch")
View Source
var (
	TopicHash = paddedEthHash(ethTopicHash("DealProposalCreate(bytes32,uint64,bool,uint256)")) // deals published on chain
)

Functions

func GenerateCommP

func GenerateCommP(filepath string) (*abi.PieceInfo, error)

GenerateCommP calculates commp locally

func HasDeal added in v1.7.3

func HasDeal(deals []abi.DealID, pdsDealId abi.DealID) bool

func IsFinalSealingState added in v1.7.3

func IsFinalSealingState(state lapi.SectorState) bool

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 market8.DealProposal) (*storagemarket.PublishDealsWaitResult, error)

type ChainDealManagerCfg

type ChainDealManagerCfg struct {
	PublishDealsConfidence uint64
}

type Config

type Config struct {
	// The maximum amount of time a transfer can take before it fails
	MaxTransferDuration time.Duration
	// Whether to do commp on the Boost node (local) or the sealing node (remote)
	RemoteCommp bool
	// The number of commp processes that can run in parallel
	MaxConcurrentLocalCommp uint64
	TransferLimiter         TransferLimiterConfig
	// Cleanup deal logs from DB older than this many number of days
	DealLogDurationDays int
	// Cache timeout for Sealing Pipeline status
	SealingPipelineCacheTimeout time.Duration
	StorageFilter               string
}

type ContractDealMonitor added in v1.6.0

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

func NewContractDealMonitor added in v1.6.0

func NewContractDealMonitor(p *Provider, a api.FullNode, subCh *gateway.EthSubHandler, cfg *config.ContractDealsConfig, maddr address.Address) *ContractDealMonitor

func (*ContractDealMonitor) Start added in v1.6.0

func (c *ContractDealMonitor) Start(ctx context.Context) error

func (*ContractDealMonitor) Stop added in v1.6.0

func (c *ContractDealMonitor) Stop() error

type CurrentDealInfo

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

type DagstoreShardRegistry added in v1.7.0

type DagstoreShardRegistry interface {
	RegisterShard(ctx context.Context, pieceCid cid.Cid, carPath string, eagerInit bool, resch chan dagstore.ShardResult) error
}

DagstoreShardRegistry provides the one method from the Dagstore that we use in deal execution: registering a shard

type HostTransferStats added in v1.4.0

type HostTransferStats struct {
	Host      string
	Total     int
	Started   int
	Stalled   int
	DealUuids []uuid.UUID
}

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(cfg Config, sqldb *sql.DB, dealsDB *db.DealsDB, fundMgr *fundmanager.FundManager, storageMgr *storagemanager.StorageManager,
	fullnodeApi v1api.FullNode, dp types.DealPublisher, addr address.Address, pa types.PieceAdder, commpCalc smtypes.CommpCalculator,
	sps sealingpipeline.API, cm types.ChainDealManager, df dtypes.StorageDealFilter, logsSqlDB *sql.DB, logsDB *db.LogsDB,
	dagst DagstoreShardRegistry, 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) CancelOfflineDealAwaitingImport added in v1.7.3

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

CancelOfflineDealAwaitingImport moves an offline deal from waiting for data state to the failed state

func (*Provider) Deal

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

func (*Provider) DealBySignedProposalCid added in v1.1.0

func (p *Provider) DealBySignedProposalCid(ctx context.Context, propCid cid.Cid) (*types.ProviderDealState, error)

func (*Provider) ExecuteDeal

func (p *Provider) ExecuteDeal(ctx context.Context, 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(ctx context.Context, dealUuid uuid.UUID, filePath string, delAfterImport bool) (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) IsTransferStalled added in v1.4.0

func (p *Provider) IsTransferStalled(dealUuid uuid.UUID) bool

Indicates if a transfer has been marked as "stalled", ie the transfer is not making any progress

func (*Provider) NBytesReceived

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

Get the number of bytes downloaded in total for the given deal

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) Transfer added in v1.4.0

func (p *Provider) Transfer(dealUuid uuid.UUID) []TransferPoint

Transfer returns samples of an active transfer, sampled for up to 20s

func (*Provider) TransferStats added in v1.4.0

func (p *Provider) TransferStats() []*HostTransferStats

func (*Provider) Transfers

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

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

type SealingPipelineCache added in v1.5.2

type SealingPipelineCache struct {
	Status     sealingpipeline.Status
	CacheTime  time.Time
	CacheError error
}

type TransferLimiterConfig added in v1.4.0

type TransferLimiterConfig struct {
	// The maximum number of concurrent transfers (soft limit - see comment below)
	MaxConcurrent uint64
	// The period between checking if a connection has stalled
	StallCheckPeriod time.Duration
	// The time that can elapse before a download is considered stalled
	StallTimeout time.Duration
}

type TransferPoint added in v1.4.0

type TransferPoint struct {
	// The time at which the sample was taken, truncated to the nearest second
	At time.Time
	// The number of bytes transferred
	Bytes uint64
}

A sample of the number of bytes transferred at the given time

Directories

Path Synopsis
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
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