Documentation ¶
Index ¶
- type Auction
- type Bid
- type BidEvent
- type BidEventType
- type CompetitionResult
- type CreateAuctionParams
- type CreateBidEventParams
- type CreateBidParams
- type CreateOrUpdateStorageProviderParams
- type DBTX
- type GetRecentWeekFailureRateRow
- type GetRecentWeekMaxOnChainSecondsRow
- type GetRecentWeekWinningRateRow
- type Queries
- func (q *Queries) Close() error
- func (q *Queries) CreateAuction(ctx context.Context, arg CreateAuctionParams) error
- func (q *Queries) CreateBid(ctx context.Context, arg CreateBidParams) error
- func (q *Queries) CreateBidEvent(ctx context.Context, arg CreateBidEventParams) error
- func (q *Queries) CreateOrUpdateStorageProvider(ctx context.Context, arg CreateOrUpdateStorageProviderParams) error
- func (q *Queries) GetAuction(ctx context.Context, id auction.ID) (Auction, error)
- func (q *Queries) GetAuctionBids(ctx context.Context, auctionID auction.ID) ([]Bid, error)
- func (q *Queries) GetAuctionWinningBids(ctx context.Context, auctionID auction.ID) ([]Bid, error)
- func (q *Queries) GetNextReadyToExecute(ctx context.Context, stuckSeconds int64) (Auction, error)
- func (q *Queries) GetRecentWeekFailureRate(ctx context.Context) ([]GetRecentWeekFailureRateRow, error)
- func (q *Queries) GetRecentWeekMaxOnChainSeconds(ctx context.Context) ([]GetRecentWeekMaxOnChainSecondsRow, error)
- func (q *Queries) GetRecentWeekWinningRate(ctx context.Context) ([]GetRecentWeekWinningRateRow, error)
- func (q *Queries) SetStorageProviderUnhealthy(ctx context.Context, arg SetStorageProviderUnhealthyParams) error
- func (q *Queries) UpdateAuctionStatusAndError(ctx context.Context, arg UpdateAuctionStatusAndErrorParams) error
- func (q *Queries) UpdateDealConfirmedAt(ctx context.Context, arg UpdateDealConfirmedAtParams) error
- func (q *Queries) UpdateDealFailedAt(ctx context.Context, arg UpdateDealFailedAtParams) error
- func (q *Queries) UpdateProposalCid(ctx context.Context, arg UpdateProposalCidParams) error
- func (q *Queries) UpdateProposalCidDeliveryError(ctx context.Context, arg UpdateProposalCidDeliveryErrorParams) error
- func (q *Queries) UpdateWinningBid(ctx context.Context, arg UpdateWinningBidParams) (int64, error)
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
- type SetStorageProviderUnhealthyParams
- type StorageProvider
- type UpdateAuctionStatusAndErrorParams
- type UpdateDealConfirmedAtParams
- type UpdateDealFailedAtParams
- type UpdateProposalCidDeliveryErrorParams
- type UpdateProposalCidParams
- type UpdateWinningBidParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auction ¶
type Auction struct { ID auction.ID `json:"id"` BatchID broker.BatchID `json:"batchID"` DealSize int64 `json:"dealSize"` DealDuration uint64 `json:"dealDuration"` DealReplication int32 `json:"dealReplication"` DealVerified bool `json:"dealVerified"` FilEpochDeadline uint64 `json:"filEpochDeadline"` ExcludedStorageProviders []string `json:"excludedStorageProviders"` PayloadCid string `json:"payloadCid"` CarUrl string `json:"carUrl"` CarIpfsCid string `json:"carIpfsCid"` CarIpfsAddrs []string `json:"carIpfsAddrs"` Status broker.AuctionStatus `json:"status"` ErrorCause string `json:"errorCause"` Duration int64 `json:"duration"` StartedAt time.Time `json:"startedAt"` UpdatedAt time.Time `json:"updatedAt"` ClientAddress string `json:"clientAddress"` Providers []string `json:"providers"` }
type Bid ¶
type Bid struct { ID auction.BidID `json:"id"` AuctionID auction.ID `json:"auctionID"` WalletAddrSig []byte `json:"walletAddrSig"` StorageProviderID string `json:"storageProviderID"` BidderID string `json:"bidderID"` AskPrice int64 `json:"askPrice"` VerifiedAskPrice int64 `json:"verifiedAskPrice"` StartEpoch int64 `json:"startEpoch"` FastRetrieval bool `json:"fastRetrieval"` ReceivedAt time.Time `json:"receivedAt"` WonAt sql.NullTime `json:"wonAt"` ProposalCid sql.NullString `json:"proposalCid"` ProposalCidDeliveredAt sql.NullTime `json:"proposalCidDeliveredAt"` ProposalCidDeliveryError sql.NullString `json:"proposalCidDeliveryError"` DealConfirmedAt sql.NullTime `json:"dealConfirmedAt"` WonReason sql.NullString `json:"wonReason"` DealFailedAt sql.NullTime `json:"dealFailedAt"` }
type BidEvent ¶
type BidEvent struct { BidID string `json:"bidID"` EventType BidEventType `json:"eventType"` Attempts sql.NullInt32 `json:"attempts"` Error sql.NullString `json:"error"` HappenedAt time.Time `json:"happenedAt"` ReceivedAt time.Time `json:"receivedAt"` }
type BidEventType ¶
type BidEventType string
const ( BidEventTypeStartFetching BidEventType = "start_fetching" BidEventTypeErrorFetching BidEventType = "error_fetching" BidEventTypeStartImporting BidEventType = "start_importing" BidEventTypeEndImporting BidEventType = "end_importing" BidEventTypeFinalized BidEventType = "finalized" BidEventTypeErrored BidEventType = "errored" )
func (*BidEventType) Scan ¶
func (e *BidEventType) Scan(src interface{}) error
type CompetitionResult ¶
type CompetitionResult struct { StorageProviderID string `json:"storageProviderID"` SuccessfulDeals int64 `json:"successfulDeals"` AuctionsWon int64 `json:"auctionsWon"` SuccessRate int32 `json:"successRate"` Bonus int32 `json:"bonus"` Total int32 `json:"total"` Gibs int64 `json:"gibs"` Qualified bool `json:"qualified"` }
type CreateAuctionParams ¶
type CreateAuctionParams struct { ID auction.ID `json:"id"` BatchID broker.BatchID `json:"batchID"` DealSize int64 `json:"dealSize"` DealDuration uint64 `json:"dealDuration"` DealReplication int32 `json:"dealReplication"` DealVerified bool `json:"dealVerified"` FilEpochDeadline uint64 `json:"filEpochDeadline"` ExcludedStorageProviders []string `json:"excludedStorageProviders"` Providers []string `json:"providers"` PayloadCid string `json:"payloadCid"` CarUrl string `json:"carUrl"` CarIpfsCid string `json:"carIpfsCid"` CarIpfsAddrs []string `json:"carIpfsAddrs"` Status broker.AuctionStatus `json:"status"` Duration int64 `json:"duration"` ClientAddress string `json:"clientAddress"` }
type CreateBidEventParams ¶
type CreateBidEventParams struct { BidID string `json:"bidID"` EventType BidEventType `json:"eventType"` Attempts sql.NullInt32 `json:"attempts"` Error sql.NullString `json:"error"` HappenedAt time.Time `json:"happenedAt"` ReceivedAt time.Time `json:"receivedAt"` }
type CreateBidParams ¶
type CreateBidParams struct { ID auction.BidID `json:"id"` AuctionID auction.ID `json:"auctionID"` WalletAddrSig []byte `json:"walletAddrSig"` StorageProviderID string `json:"storageProviderID"` BidderID string `json:"bidderID"` AskPrice int64 `json:"askPrice"` VerifiedAskPrice int64 `json:"verifiedAskPrice"` StartEpoch int64 `json:"startEpoch"` FastRetrieval bool `json:"fastRetrieval"` ReceivedAt time.Time `json:"receivedAt"` }
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) CreateAuction ¶
func (q *Queries) CreateAuction(ctx context.Context, arg CreateAuctionParams) error
func (*Queries) CreateBid ¶
func (q *Queries) CreateBid(ctx context.Context, arg CreateBidParams) error
func (*Queries) CreateBidEvent ¶
func (q *Queries) CreateBidEvent(ctx context.Context, arg CreateBidEventParams) error
func (*Queries) CreateOrUpdateStorageProvider ¶
func (q *Queries) CreateOrUpdateStorageProvider(ctx context.Context, arg CreateOrUpdateStorageProviderParams) error
func (*Queries) GetAuction ¶
func (*Queries) GetAuctionBids ¶
func (*Queries) GetAuctionWinningBids ¶
func (*Queries) GetNextReadyToExecute ¶
func (*Queries) GetRecentWeekFailureRate ¶
func (q *Queries) GetRecentWeekFailureRate(ctx context.Context) ([]GetRecentWeekFailureRateRow, error)
here's the logic: 1. take all winning bids happened in the recent week until 1 day ago (to exclude the deals waiting to be on-chain), or if their deals failed. 2. calculate the freshness of each bid, ranging from 1 (1 week ago) to 7 (1 day ago). 3. sum up the failed bids (not be able to make a deal), weighed by their freshness, then divide by the number of wins.
func (*Queries) GetRecentWeekMaxOnChainSeconds ¶
func (q *Queries) GetRecentWeekMaxOnChainSeconds(ctx context.Context) ([]GetRecentWeekMaxOnChainSecondsRow, error)
get the maximum time in the last week a storage provider making a deal on chain.
func (*Queries) GetRecentWeekWinningRate ¶
func (q *Queries) GetRecentWeekWinningRate(ctx context.Context) ([]GetRecentWeekWinningRateRow, error)
here's the logic: 1. take all received bids happened in the recent week until 10 minutes ago (to exclude the ongoing ones). 2. calculate the freshness of each bid, ranging from 1 (1 week ago) to 1008 (10 minutes ago). 3. sum up the winning bids, weighed by their freshness, then divide by the number of received bids.
func (*Queries) SetStorageProviderUnhealthy ¶
func (q *Queries) SetStorageProviderUnhealthy(ctx context.Context, arg SetStorageProviderUnhealthyParams) error
func (*Queries) UpdateAuctionStatusAndError ¶
func (q *Queries) UpdateAuctionStatusAndError(ctx context.Context, arg UpdateAuctionStatusAndErrorParams) error
func (*Queries) UpdateDealConfirmedAt ¶
func (q *Queries) UpdateDealConfirmedAt(ctx context.Context, arg UpdateDealConfirmedAtParams) error
func (*Queries) UpdateDealFailedAt ¶
func (q *Queries) UpdateDealFailedAt(ctx context.Context, arg UpdateDealFailedAtParams) error
func (*Queries) UpdateProposalCid ¶
func (q *Queries) UpdateProposalCid(ctx context.Context, arg UpdateProposalCidParams) error
func (*Queries) UpdateProposalCidDeliveryError ¶
func (q *Queries) UpdateProposalCidDeliveryError(ctx context.Context, arg UpdateProposalCidDeliveryErrorParams) error
func (*Queries) UpdateWinningBid ¶
type SetStorageProviderUnhealthyParams ¶
type SetStorageProviderUnhealthyParams struct { ID string `json:"id"` LastUnhealthyError sql.NullString `json:"lastUnhealthyError"` }
type StorageProvider ¶
type StorageProvider struct { ID string `json:"id"` BidbotVersion string `json:"bidbotVersion"` DealStartWindow int64 `json:"dealStartWindow"` CidGravityConfigured bool `json:"cidGravityConfigured"` CidGravityStrict bool `json:"cidGravityStrict"` FirstSeenAt time.Time `json:"firstSeenAt"` LastSeenAt time.Time `json:"lastSeenAt"` LastUnhealthyAt sql.NullTime `json:"lastUnhealthyAt"` LastUnhealthyError sql.NullString `json:"lastUnhealthyError"` }
type UpdateAuctionStatusAndErrorParams ¶
type UpdateAuctionStatusAndErrorParams struct { ID auction.ID `json:"id"` Status broker.AuctionStatus `json:"status"` ErrorCause string `json:"errorCause"` }