market

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0, MIT Imports: 26 Imported by: 36

Documentation

Index

Constants

View Source
const (
	ShardStateNew          = "ShardStateNew"
	ShardStateInitializing = "ShardStateInitializing"
	ShardStateAvailable    = "ShardStateAvailable"
	ShardStateServing      = "ShardStateServing"
	ShardStateRecovering   = "ShardStateRecovering"
	ShardStateErrored      = "ShardStateErrored"
	ShardStateUnknown      = "ShardStateUnknown"
)

refer: https://github.com/filecoin-project/dagstore/blob/master/shard_state.go#L37

View Source
const (
	DirInbound  = 1
	DirOutbound = 2
)

Variables

View Source
var ErrChannelNotFound = fmt.Errorf("channel not found")

Functions

This section is empty.

Types

type ChannelInfo

type ChannelInfo struct {
	// ChannelID is a uuid set at channel creation
	ChannelID string
	// Channel address - may be nil if the channel hasn't been created yet
	Channel *address.Address
	// Control is the address of the local node
	Control address.Address
	// Target is the address of the remote node (on the other end of the channel)
	Target address.Address
	// Direction indicates if the channel is inbound (Control is the "to" address)
	// or outbound (Control is the "from" address)
	Direction uint64
	// Vouchers is a list of all vouchers sent on the channel
	Vouchers []*VoucherInfo
	// NextLane is the number of the next lane that should be used when the
	// client requests a new lane (eg to create a voucher for a new deal)
	NextLane uint64
	// Amount added to the channel.
	// Note: This amount is only used by GetPaych to keep track of how much
	// has locally been added to the channel. It should reflect the channel's
	// Balance on chain as long as all operations occur on the same datastore.
	Amount big.Int
	// AvailableAmount indicates how much afil is non-reserved
	AvailableAmount big.Int
	// PendingAvailableAmount is available amount that we're awaiting confirmation of
	PendingAvailableAmount big.Int
	// PendingAmount is the amount that we're awaiting confirmation of
	PendingAmount big.Int
	// CreateMsg is the CID of a pending create message (while waiting for confirmation)
	CreateMsg *cid.Cid
	// AddFundsMsg is the CID of a pending add funds message (while waiting for confirmation)
	AddFundsMsg *cid.Cid
	// Settling indicates whether the channel has entered into the settling state
	Settling bool

	TimeStamp
}

ChannelInfo keeps track of information about a channel

func (*ChannelInfo) From

func (ci *ChannelInfo) From() address.Address

func (*ChannelInfo) HasVoucher

func (ci *ChannelInfo) HasVoucher(sv *types.SignedVoucher) (bool, error)

func (*ChannelInfo) InfoForVoucher

func (ci *ChannelInfo) InfoForVoucher(sv *types.SignedVoucher) (*VoucherInfo, error)

infoForVoucher gets the VoucherInfo for the given voucher. returns nil if the channel doesn't have the voucher.

func (*ChannelInfo) MarkVoucherSubmitted

func (ci *ChannelInfo) MarkVoucherSubmitted(sv *types.SignedVoucher) error

markVoucherSubmitted marks the voucher, and any vouchers of lower nonce in the same lane, as being submitted. Note: This method doesn't write anything to the store.

func (*ChannelInfo) MarshalCBOR

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

func (*ChannelInfo) To

func (ci *ChannelInfo) To() address.Address

func (*ChannelInfo) UnmarshalCBOR

func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) (err error)

func (*ChannelInfo) WasVoucherSubmitted

func (ci *ChannelInfo) WasVoucherSubmitted(sv *types.SignedVoucher) (bool, error)

wasVoucherSubmitted returns true if the voucher has been submitted

type DagstoreInitializeAllEvent

type DagstoreInitializeAllEvent struct {
	Key     string
	Event   string // "start", "end"
	Success bool
	Error   string
	Total   int
	Current int
}

DagstoreInitializeAllEvent represents an initialization event.

type DagstoreInitializeAllParams

type DagstoreInitializeAllParams struct {
	MaxConcurrency int
	IncludeSealed  bool
}

type DagstoreShardInfo

type DagstoreShardInfo struct {
	Key   string
	State string
	Error string
}

DagstoreShardInfo is the serialized form of dagstore.DagstoreShardInfo that we expose through JSON-RPC to avoid clients having to depend on the dagstore lib.

type DagstoreShardResult

type DagstoreShardResult struct {
	Key     string
	Success bool
	Error   string
}

DagstoreShardResult enumerates results per shard.

type DataTransferChannel

type DataTransferChannel struct {
	TransferID  datatransfer.TransferID
	Status      datatransfer.Status
	BaseCID     cid.Cid
	IsInitiator bool
	IsSender    bool
	Voucher     string
	Message     string
	OtherPeer   peer.ID
	Transferred uint64
	Stages      *datatransfer.ChannelStages
}

func NewDataTransferChannel

func NewDataTransferChannel(hostID peer.ID, channelState datatransfer.ChannelState) DataTransferChannel

NewDataTransferChannel constructs an API DataTransferChannel type from full channel state snapshot and a host id

type DealInfo

type DealInfo struct {
	piecestore.DealInfo
	types.ClientDealProposal

	TransferType  string
	Root          cid.Cid
	PublishCid    cid.Cid
	FastRetrieval bool
	Status        PieceStatus
}

type DealInfoIncludePath

type DealInfoIncludePath struct {
	types.DealProposal
	Offset          abi.PaddedPieceSize
	Length          abi.PaddedPieceSize
	PayloadSize     uint64
	DealID          abi.DealID
	TotalStorageFee abi.TokenAmount
	FastRetrieval   bool
	PublishCid      cid.Cid
}

type DealInfoV2 added in v1.15.0

type DealInfoV2 struct {
	DealID     abi.DealID
	PublishCid cid.Cid

	AllocationID types.AllocationId

	PieceCID    cid.Cid
	PieceSize   abi.PaddedPieceSize
	Client      address.Address
	Provider    address.Address
	Offset      abi.PaddedPieceSize
	Length      abi.PaddedPieceSize
	PayloadSize uint64
	StartEpoch  abi.ChainEpoch
	EndEpoch    abi.ChainEpoch
}

func (*DealInfoV2) IsBuiltinMarket added in v1.15.0

func (d *DealInfoV2) IsBuiltinMarket() bool

type DirectDeal added in v1.15.0

type DirectDeal struct {
	ID        uuid.UUID
	PieceCID  cid.Cid
	PieceSize abi.PaddedPieceSize
	Client    address.Address
	Provider  address.Address

	PayloadSize uint64

	State DirectDealState

	AllocationID uint64
	ClaimID      uint64

	SectorID abi.SectorNumber
	Offset   abi.PaddedPieceSize
	Length   abi.PaddedPieceSize

	StartEpoch abi.ChainEpoch
	EndEpoch   abi.ChainEpoch

	Message string

	TimeStamp
}

type DirectDealInfo added in v1.15.0

type DirectDealInfo struct {
	AllocationID types.AllocationId
	PieceCID     cid.Cid
	PieceSize    abi.PaddedPieceSize
	Client       address.Address
	Provider     address.Address
	Offset       abi.PaddedPieceSize
	Length       abi.PaddedPieceSize
	PayloadSize  uint64
	StartEpoch   abi.ChainEpoch
	EndEpoch     abi.ChainEpoch
}

type DirectDealParam added in v1.15.0

type DirectDealParam struct {
	// FilePath and PayloadSize cannot both be empty
	FilePath    string
	PayloadSize uint64

	DealUUID     uuid.UUID
	AllocationID uint64
	PieceCID     cid.Cid
	Client       address.Address
	StartEpoch   abi.ChainEpoch
	EndEpoch     abi.ChainEpoch
}

type DirectDealParams added in v1.15.0

type DirectDealParams struct {
	// Commp will not be calculated and verified
	SkipCommP bool
	// not copy car file to piece storage
	NoCopyCarFile bool
	// skip generate index
	SkipGenerateIndex bool

	DealParams []DirectDealParam
}

type DirectDealQueryParams added in v1.15.0

type DirectDealQueryParams struct {
	Provider address.Address
	Client   address.Address
	State    *DirectDealState

	Page
	Asc bool
}

type DirectDealState added in v1.15.0

type DirectDealState int
const (
	DealAllocated DirectDealState = iota + 1
	DealSealing
	DealActive
	DealExpired
	DealSlashed
	DealError
)

func (DirectDealState) String added in v1.15.0

func (d DirectDealState) String() string

type FsStorage added in v1.6.1

type FsStorage struct {
	Path     string
	Name     string
	ReadOnly bool
	Status   StorageStatus
}

type FundedAddressState

type FundedAddressState struct {
	Addr address.Address
	// AmtReserved is the amount that must be kept in the address (cannot be
	// withdrawn)
	AmtReserved abi.TokenAmount
	// MsgCid is the cid of an in-progress on-chain message
	MsgCid *cid.Cid
	TimeStamp
}

FundedAddressState keeps track of the state of an address with funds in the datastore

func (*FundedAddressState) MarshalCBOR

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

func (*FundedAddressState) UnmarshalCBOR

func (t *FundedAddressState) UnmarshalCBOR(r io.Reader) (err error)

type GetDealSpec

type GetDealSpec struct {
	// max limit of deal count
	MaxPiece int

	// max limit of date size in one single deal
	MaxPieceSize uint64

	// min limit of deal count
	MinPiece int

	// min limit of data size in one single deal
	MinPieceSize uint64

	// min limit of total space used by deals
	MinUsedSpace uint64

	// start epoch limit of the chosen deals
	// if set, the deals should not be activated before or equal than the this epoch
	StartEpoch abi.ChainEpoch

	// end epoch limit of the chosen deals
	// if set, the deals should not be alive after or equal than the this epoch
	EndEpoch abi.ChainEpoch

	// Filter by sector lifetime, for snapdeal
	SectorExpiration *abi.ChainEpoch
}

type ImportDataRef added in v1.12.0

type ImportDataRef struct {
	ProposalCID cid.Cid
	UUID        uuid.UUID
	File        string
}

type ImportDataRefs added in v1.12.0

type ImportDataRefs struct {
	Refs      []*ImportDataRef
	SkipCommP bool
}

type ImportDataResult added in v1.12.0

type ImportDataResult struct {
	// Target may deal proposal cid or deal uuid
	Target string
	// deal import failed
	Message string
}

type MarketBalance

type MarketBalance struct {
	Escrow big.Int
	Locked big.Int
}

type MinerAddress

type MinerAddress = address.Address

type MinerDeal

type MinerDeal struct {
	ID uuid.UUID
	types.ClientDealProposal
	ProposalCid           cid.Cid
	AddFundsCid           *cid.Cid
	PublishCid            *cid.Cid
	Miner                 peer.ID
	Client                peer.ID
	State                 storagemarket.StorageDealStatus
	PiecePath             filestore.Path
	PayloadSize           uint64
	MetadataPath          filestore.Path
	SlashEpoch            abi.ChainEpoch
	FastRetrieval         bool
	Message               string
	FundsReserved         abi.TokenAmount
	Ref                   *storagemarket.DataRef
	AvailableForRetrieval bool

	DealID       abi.DealID
	CreationTime cbg.CborTime

	TransferChannelID *datatransfer.ChannelID `json:"TransferChannelId"`
	SectorNumber      abi.SectorNumber

	Offset      abi.PaddedPieceSize
	PieceStatus PieceStatus

	InboundCAR string

	TimeStamp
}

func (*MinerDeal) FilMarketMinerDeal

func (deal *MinerDeal) FilMarketMinerDeal() *storagemarket.MinerDeal

func (*MinerDeal) MarshalCBOR

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

func (*MinerDeal) UnmarshalCBOR

func (t *MinerDeal) UnmarshalCBOR(r io.Reader) (err error)

type MinerID

type MinerID = abi.ActorID

type MsgInfo

type MsgInfo struct {
	// ChannelID links the message to a channel
	ChannelID string
	// MsgCid is the CID of the message
	MsgCid cid.Cid
	// Received indicates whether a response has been received
	Received bool
	// Err is the error received in the response
	Err string
	TimeStamp
}

MsgInfo stores information about a create channel / add funds message that has been sent

func (*MsgInfo) MarshalCBOR

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

func (*MsgInfo) UnmarshalCBOR

func (t *MsgInfo) UnmarshalCBOR(r io.Reader) (err error)

type Page added in v1.11.0

type Page struct {
	Offset int
	Limit  int
}

type PendingDealInfo

type PendingDealInfo struct {
	Deals              []types.ClientDealProposal
	PublishPeriodStart time.Time
	PublishPeriod      time.Duration
}

PendingDealInfo has info about pending deals and when they are due to be published

type PieceInfo

type PieceInfo struct {
	PieceCID cid.Cid
	Deals    []*DealInfo
}

type PieceStatus added in v1.2.4

type PieceStatus string
const (
	Undefine PieceStatus = "Undefine"
	Assigned PieceStatus = "Assigned"
	Packing  PieceStatus = "Packing"
	Proving  PieceStatus = "Proving"
)

type PieceStorageInfos added in v1.6.1

type PieceStorageInfos struct {
	FsStorage []FsStorage
	S3Storage []S3Storage
}

type ProviderDealState

type ProviderDealState struct {
	retrievalmarket.DealProposal
	StoreID               uint64
	SelStorageProposalCid cid.Cid
	ChannelID             *datatransfer.ChannelID
	Status                retrievalmarket.DealStatus
	Receiver              peer.ID
	TotalSent             uint64
	FundsReceived         abi.TokenAmount
	Message               string
	CurrentInterval       uint64
	LegacyProtocol        bool
	TimeStamp
}

ProviderDealState is the current state of a deal from the point of view of a retrieval provider

func (ProviderDealState) Identifier

Identifier provides a unique id for this provider deal

func (*ProviderDealState) IntervalLowerBound

func (deal *ProviderDealState) IntervalLowerBound() uint64

func (*ProviderDealState) MarshalCBOR

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

func (*ProviderDealState) NextInterval

func (deal *ProviderDealState) NextInterval() uint64

func (*ProviderDealState) TotalPaidFor

func (deal *ProviderDealState) TotalPaidFor() uint64

func (*ProviderDealState) UnmarshalCBOR

func (t *ProviderDealState) UnmarshalCBOR(r io.Reader) (err error)

type RetrievalAsk

type RetrievalAsk struct {
	Miner                   address.Address
	PricePerByte            abi.TokenAmount
	UnsealPrice             abi.TokenAmount
	PaymentInterval         uint64
	PaymentIntervalIncrease uint64
	TimeStamp
}

func (*RetrievalAsk) MarshalCBOR

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

func (*RetrievalAsk) UnmarshalCBOR

func (t *RetrievalAsk) UnmarshalCBOR(r io.Reader) (err error)

type RetrievalDealQueryParams added in v1.11.0

type RetrievalDealQueryParams struct {
	Receiver          string
	PayloadCID        string
	Status            *uint64
	DiscardFailedDeal bool

	Page
}

type RetrievalDealStatistic added in v1.7.0

type RetrievalDealStatistic struct {
	DealsStatus map[retrievalmarket.DealStatus]int64
}

RetrievalDealStatistic storage statistical information The struct is used here for statistical information that may need to be added in the future

type S3Storage added in v1.6.1

type S3Storage struct {
	Name     string
	ReadOnly bool
	EndPoint string
	Bucket   string
	SubDir   string
	Status   StorageStatus
}

type SectorSize

type SectorSize = abi.SectorSize

type SignInfo

type SignInfo struct {
	Data interface{}
	Type types.MsgType
	Addr address.Address
}

type SignedStorageAsk added in v1.8.0

type SignedStorageAsk struct {
	Ask       *storagemarket.StorageAsk
	Signature *crypto.Signature
	TimeStamp
}

SignedStorageAsk use to record provider's requirement in database

func (*SignedStorageAsk) MarshalCBOR added in v1.8.0

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

func (*SignedStorageAsk) ToChainAsk added in v1.8.0

func (*SignedStorageAsk) UnmarshalCBOR added in v1.8.0

func (t *SignedStorageAsk) UnmarshalCBOR(r io.Reader) (err error)

type StorageDealQueryParams added in v1.11.0

type StorageDealQueryParams struct {
	// provider
	Miner             address.Address
	State             *uint64
	Client            string
	DiscardFailedDeal bool

	DealID   abi.DealID
	PieceCID string

	Page
	Asc bool
}

type StorageDealStatistic added in v1.7.0

type StorageDealStatistic struct {
	DealsStatus map[storagemarket.StorageDealStatus]int64
}

StorageDealStatistic storage statistical information The struct is used here for statistical information that may need to be added in the future

type StorageStatus added in v1.7.0

type StorageStatus struct {
	Capacity  int64
	Available int64
	Reserved  int64
}

type TimeStamp added in v1.7.0

type TimeStamp struct {
	CreatedAt uint64
	UpdatedAt uint64
}

func (*TimeStamp) MarshalCBOR added in v1.7.0

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

func (*TimeStamp) UnmarshalCBOR added in v1.7.0

func (t *TimeStamp) UnmarshalCBOR(r io.Reader) (err error)

type User

type User struct {
	Addr    address.Address
	Account string
}

type VoucherInfo

type VoucherInfo struct {
	Voucher   *types.SignedVoucher
	Proof     []byte // ignored
	Submitted bool
}

func (*VoucherInfo) MarshalCBOR

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

func (*VoucherInfo) UnmarshalCBOR

func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) (err error)

type VoucherInfos

type VoucherInfos []*VoucherInfo

func (*VoucherInfos) Scan

func (info *VoucherInfos) Scan(value interface{}) error

func (VoucherInfos) Value

func (info VoucherInfos) Value() (driver.Value, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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