Documentation ¶
Index ¶
- Variables
- type Bid
- type BidStatus
- type Order
- type ProgressReporter
- type Query
- type Store
- func (s *Store) Close() error
- func (s *Store) GC(discardOrphanDealsAfter time.Duration) (bidsRemoved, filesRemoved, filesEvaluated int)
- func (s *Store) GetBid(id auction.BidID) (*Bid, error)
- func (s *Store) HealthCheck() error
- func (s *Store) ListBids(query Query) ([]*Bid, error)
- func (s *Store) SaveBid(bid Bid) error
- func (s *Store) SetAwaitingProposalCid(id auction.BidID, sources auction.Sources) error
- func (s *Store) SetProposalCid(id auction.BidID, pcid cid.Cid) error
- func (s *Store) WriteDataURI(bidID auction.BidID, payloadCid, uri string, size uint64) (string, error)
- func (s *Store) WriteDealData(b *Bid) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ( // DataURIFetchStartDelay is the time delay before the store will process queued data uri fetches on start. DataURIFetchStartDelay = time.Second * 10 // MaxDataURIFetchConcurrency is the maximum number of data uri fetches that will be handled concurrently. MaxDataURIFetchConcurrency = 3 // ErrBidNotFound indicates the requested bid was not found. ErrBidNotFound = errors.New("bid not found") )
Functions ¶
This section is empty.
Types ¶
type Bid ¶
type Bid struct { ID auction.BidID AuctionID auction.ID AuctioneerID peer.ID PayloadCid cid.Cid DealSize uint64 DealDuration uint64 ClientAddress string Sources auction.Sources Status BidStatus AskPrice int64 // attoFIL per GiB per epoch VerifiedAskPrice int64 // attoFIL per GiB per epoch StartEpoch uint64 FastRetrieval bool ProposalCid cid.Cid DataURIFetchAttempts uint32 CreatedAt time.Time UpdatedAt time.Time ErrorCause string }
Bid defines the core bid model from a miner's perspective.
type BidStatus ¶
type BidStatus int
BidStatus is the status of a Bid.
const ( // BidStatusUnspecified indicates the initial or invalid status of a bid. BidStatusUnspecified BidStatus = iota // BidStatusSubmitted indicates the bid was successfully submitted to the auctioneer. BidStatusSubmitted // BidStatusAwaitingProposal indicates the bid was accepted and is awaiting proposal cid from auctioneer. BidStatusAwaitingProposal // BidStatusQueuedData indicates the bid proposal cid was received but data fetching is queued. BidStatusQueuedData // BidStatusFetchingData indicates the bid data uri is being fetched. BidStatusFetchingData // BidStatusFinalized indicates the bid has been accepted and the data has been imported to Lotus. BidStatusFinalized // BidStatusErrored indicates a fatal error has occurred and the bid should be considered abandoned. BidStatusErrored )
func BidStatusByString ¶
BidStatusByString finds a status by its string representation, or errors if the status does not exist.
type Order ¶
type Order int
Order specifies the order of list results. Default is decending by time created.
type ProgressReporter ¶ added in v0.1.2
type ProgressReporter interface { StartFetching(bidID auction.BidID, attempts uint32) ErrorFetching(bidID auction.BidID, attempts uint32, err error) StartImporting(bidID auction.BidID, attempts uint32) EndImporting(bidID auction.BidID, attempts uint32, err error) Finalized(bidID auction.BidID) Errored(bidID auction.BidID, errrorCause string) }
ProgressReporter reports the progress processing a deal.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store stores miner auction deal bids.
func NewStore ¶
func NewStore( store txndswrap.TxnDatastore, fc filclient.FilClient, lc lotusclient.LotusClient, dealDataDirectory string, dealDataFetchAttempts uint32, dealDataFetchTimeout time.Duration, dealProgressReporter ProgressReporter, discardOrphanDealsAfter time.Duration, bytesLimiter limiter.Limiter, concurrentImports int, boostDownload bool, ) (*Store, error)
NewStore returns a new Store.
func (*Store) GC ¶
func (s *Store) GC(discardOrphanDealsAfter time.Duration) (bidsRemoved, filesRemoved, filesEvaluated int)
GC cleans up deal data files, if discardOrphanDealsAfter is not zero, it also removes bids staying at BidStatusAwaitingProposal for that longer.
func (*Store) GetBid ¶
GetBid returns a bid by id. If a bid is not found for id, ErrBidNotFound is returned.
func (*Store) HealthCheck ¶
HealthCheck checks if the store is healthy enough to participate in bidding.
func (*Store) SetAwaitingProposalCid ¶
SetAwaitingProposalCid updates bid with the given sources and switch status to BidStatusAwaitingProposal. If a bid is not found for id, ErrBidNotFound is returned.
func (*Store) SetProposalCid ¶
SetProposalCid sets the bid proposal cid and updates status to BidStatusQueuedData. If a bid is not found for id, ErrBidNotFound is returned.