store

package
v0.0.0-...-269d6e4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusDealMaking indicates that an auction data is ready for deal making.
	StatusDealMaking = AuctionDealStatus(db.StatusDealMaking)
	// StatusConfirmation indicates that a deal is pending to be confirmed.
	StatusConfirmation = AuctionDealStatus(db.StatusConfirmation)
	// StatusReportFinalized indicates that a deal result is pending to be reported.
	StatusReportFinalized = AuctionDealStatus(db.StatusReportFinalized)
	// StatusFinalized indicates that a deal result has been reported and all processing is complete.
	StatusFinalized = AuctionDealStatus(db.StatusFinalized)
)

Variables

View Source
var (

	// ErrNotFound is returned if the item isn't found in the store.
	ErrNotFound = errors.New("id not found")

	// ErrAuctionDataExists indicates that the auction data already exists.
	ErrAuctionDataExists = errors.New("auction data already exists")
)

Functions

This section is empty.

Types

type AuctionData

type AuctionData struct {
	ID         string
	BatchID    broker.BatchID
	PayloadCid cid.Cid
	PieceCid   cid.Cid
	PieceSize  uint64
	Duration   uint64
	CreatedAt  time.Time
	CARURL     string
}

AuctionData contains information of data to be stored in Filecoin.

type AuctionDeal

type AuctionDeal db.AuctionDeal

AuctionDeal contains information to make a deal with a particular storage-provider. The data information is stored in the linked AuctionData.

type AuctionDealStatus

type AuctionDealStatus db.Status

AuctionDealStatus is the type of action deal status.

type RemoteWallet

type RemoteWallet = db.RemoteWallet

RemoteWallet contains configuration of a remote wallet.

type Store

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

Store provides persistent storage for Bids.

func New

func New(postgresURI string) (*Store, error)

New returns a *Store.

func (*Store) Create

func (s *Store) Create(ctx context.Context, ad *AuctionData, ads []*AuctionDeal, rw *broker.RemoteWallet) error

Create persist new auction data and a set of related auction deals. It writes the IDs back to the parameters passed in.

func (*Store) GetAuctionData

func (s *Store) GetAuctionData(ctx context.Context, auctionDataID string) (ad AuctionData, err error)

GetAuctionData returns an auction data by id.

func (*Store) GetNextPending

func (s *Store) GetNextPending(ctx context.Context, status AuctionDealStatus) (ad AuctionDeal, exists bool, err error)

GetNextPending returns the next auction deal in the provided status and marks the deal as executing. If none exists, it returns false in the second parameter.

func (*Store) GetRemoteWallet

func (s *Store) GetRemoteWallet(ctx context.Context, auctionDataID string) (rw *RemoteWallet, err error)

GetRemoteWallet returns the remote wallet configuration for an auction if exists. If the auction deal wasn't configured with a remote wallet, *it will return nil without an error*.

func (*Store) GetStatusCounts

func (s *Store) GetStatusCounts(ctx context.Context) (map[storagemarket.StorageDealStatus]int64, error)

GetStatusCounts returns a summary of in which deal statuses are watched deals.

func (*Store) GetStatusForStatusID

func (s *Store) GetStatusForStatusID(
	ctx context.Context,
	id storagemarket.StorageDealStatus,
) (status string, ok bool, err error)

GetStatusForStatusID returns the string enum representation for the given storage deal status.

func (*Store) SaveAndMoveAuctionDeal

func (s *Store) SaveAndMoveAuctionDeal(ctx context.Context, aud AuctionDeal, newStatus AuctionDealStatus) error

SaveAndMoveAuctionDeal persists a modified auction deal, moves it to the provided status and marks it as not executing.

Directories

Path Synopsis
internal
db
Package migrations generated by go-bindata.// sources: migrations/001_init.down.sql migrations/001_init.up.sql migrations/002_market_status.down.sql migrations/002_market_status.up.sql migrations/003_remote_wallet.down.sql migrations/003_remote_wallet.up.sql migrations/004_dealer_api.down.sql migrations/004_dealer_api.up.sql migrations/005_market_deal_status_comment.down.sql migrations/005_market_deal_status_comment.up.sql migrations/006_postgraphile_status_enum.down.sql migrations/006_postgraphile_status_enum.up.sql migrations/007_dealuid.down.sql migrations/007_dealuid.up.sql migrations/008_boost_whitelist_removal.down.sql migrations/008_boost_whitelist_removal.up.sql
Package migrations generated by go-bindata.// sources: migrations/001_init.down.sql migrations/001_init.up.sql migrations/002_market_status.down.sql migrations/002_market_status.up.sql migrations/003_remote_wallet.down.sql migrations/003_remote_wallet.up.sql migrations/004_dealer_api.down.sql migrations/004_dealer_api.up.sql migrations/005_market_deal_status_comment.down.sql migrations/005_market_deal_status_comment.up.sql migrations/006_postgraphile_status_enum.down.sql migrations/006_postgraphile_status_enum.up.sql migrations/007_dealuid.down.sql migrations/007_dealuid.up.sql migrations/008_boost_whitelist_removal.down.sql migrations/008_boost_whitelist_removal.up.sql

Jump to

Keyboard shortcuts

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