Documentation ¶
Index ¶
- Variables
- type Store
- func (s *Store) AddDeals(ctx context.Context, auction broker.ClosedAuction) (acceptedWinners []string, err error)
- func (s *Store) BatchError(ctx context.Context, id broker.BatchID, errorCause string, rebatch bool) (brIDs []broker.StorageRequestID, err error)
- func (s *Store) BatchSuccess(ctx context.Context, id broker.BatchID) error
- func (s *Store) BatchToAuctioning(ctx context.Context, id broker.BatchID, pieceCid cid.Cid, pieceSize uint64) error
- func (s *Store) CreateBatch(ctx context.Context, ba *broker.Batch, brIDs []broker.StorageRequestID, ...) error
- func (s *Store) CreateStorageRequest(ctx context.Context, br broker.StorageRequest) error
- func (s *Store) CtxWithTx(ctx context.Context, opts ...storeutil.TxOptions) (context.Context, error)
- func (s *Store) DeleteExecuting(ctx context.Context, id string) error
- func (s *Store) GetBatch(ctx context.Context, id broker.BatchID) (ba *broker.Batch, err error)
- func (s *Store) GetBatchManifest(ctx context.Context, id broker.BatchID) ([]byte, error)
- func (s *Store) GetDeals(ctx context.Context, id broker.BatchID) (deals []db.Deal, err error)
- func (s *Store) GetExcludedStorageProviders(ctx context.Context, pieceCid cid.Cid, origin string) (sps []string, err error)
- func (s *Store) GetRemoteWalletConfig(ctx context.Context, id broker.BatchID) (rw *broker.RemoteWallet, err error)
- func (s *Store) GetStorageRequest(ctx context.Context, id broker.StorageRequestID) (br broker.StorageRequest, err error)
- func (s *Store) GetStorageRequestIDs(ctx context.Context, id broker.BatchID) (brIDs []broker.StorageRequestID, err error)
- func (s *Store) OperationExists(ctx context.Context, opID string) (exists bool, err error)
- func (s *Store) SaveDeals(ctx context.Context, fad broker.FinalizedDeal) error
- func (s *Store) UnpinJobGetNext(ctx context.Context) (UnpinJob, bool, error)
- func (s *Store) UnpinJobMoveToPending(ctx context.Context, id string, delay time.Duration) error
- type UnpinJob
- type UnpinType
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned if the storage request doesn't exist. ErrNotFound = fmt.Errorf("not found") // ErrBatchExists if the provided batch id already exists. ErrBatchExists = errors.New("batch-id already exists") // ErrBatchInAuction if the provided batch id is already in auction status. ErrBatchInAuction = errors.New("batch-id already in auction") // ErrBatchContainsUnknownStorageRequest is returned if a batch contains an // unknown storage request. ErrBatchContainsUnknownStorageRequest = fmt.Errorf("batch contains an unknown storage request") )
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides a persistent layer for storage requests.
func (*Store) AddDeals ¶
func (s *Store) AddDeals(ctx context.Context, auction broker.ClosedAuction) (acceptedWinners []string, err error)
AddDeals includes new deals from a finalized auction. Confirming the winners in the database can discover the fact that a concurrent auction already made some of them winners. The fully confirmed accepted winners are returned in the acceptedWinners return parameter.
func (*Store) BatchError ¶
func (s *Store) BatchError( ctx context.Context, id broker.BatchID, errorCause string, rebatch bool) (brIDs []broker.StorageRequestID, err error)
BatchError moves a batch to an error status with a specified error cause.
func (*Store) BatchSuccess ¶
BatchSuccess moves a batch and the underlying storage requests to Success status.
func (*Store) BatchToAuctioning ¶
func (s *Store) BatchToAuctioning( ctx context.Context, id broker.BatchID, pieceCid cid.Cid, pieceSize uint64) error
BatchToAuctioning moves a batch and the underlying storage requests to Auctioning status.
func (*Store) CreateBatch ¶
func (s *Store) CreateBatch( ctx context.Context, ba *broker.Batch, brIDs []broker.StorageRequestID, manifest []byte, rw *broker.RemoteWallet) error
CreateBatch persists a batch.
func (*Store) CreateStorageRequest ¶
CreateStorageRequest creates the provided StorageRequest in store.
func (*Store) CtxWithTx ¶
func (s *Store) CtxWithTx(ctx context.Context, opts ...storeutil.TxOptions) (context.Context, error)
CtxWithTx attach a database transaction to the context. It returns the context unchanged if there's error starting the transaction.
func (*Store) DeleteExecuting ¶
DeleteExecuting removes an executing unpin job.
func (*Store) GetBatch ¶
GetBatch gets an existing batch by id. If the batch doesn't exists, it returns ErrNotFound.
func (*Store) GetBatchManifest ¶
GetBatchManifest gets the stored manifest of a batch. If none is found it returns ErrNotFound.
func (*Store) GetExcludedStorageProviders ¶
func (s *Store) GetExcludedStorageProviders( ctx context.Context, pieceCid cid.Cid, origin string) (sps []string, err error)
GetExcludedStorageProviders returns a list of all storage providers that have won auctions fired by the origin for the provided PieceCid. Note that this considers all auctions history for the PieceCid and the origin.
func (*Store) GetRemoteWalletConfig ¶
func (s *Store) GetRemoteWalletConfig(ctx context.Context, id broker.BatchID) (rw *broker.RemoteWallet, err error)
GetRemoteWalletConfig gets the remote wallet configured to sign deals from a batch. If none was configured, it *does not return an error but a nil result*.
func (*Store) GetStorageRequest ¶
func (s *Store) GetStorageRequest( ctx context.Context, id broker.StorageRequestID) (br broker.StorageRequest, err error)
GetStorageRequest gets a StorageRequest with the specified `id`. If not found returns ErrNotFound.
func (*Store) GetStorageRequestIDs ¶
func (s *Store) GetStorageRequestIDs(ctx context.Context, id broker.BatchID) ( brIDs []broker.StorageRequestID, err error)
GetStorageRequestIDs gets the ids of the storage requests for a batch.
func (*Store) OperationExists ¶
OperationExists checks if the operation ID already exists in db.
func (*Store) SaveDeals ¶
SaveDeals saves a new finalized (succeeded or errored) auction deal into the batch.
func (*Store) UnpinJobGetNext ¶
UnpinJobGetNext returns the next pending unpin job to execute.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
Package migrations generated by go-bindata.// sources: migrations/001_init.down.sql migrations/001_init.up.sql migrations/002_rw.down.sql migrations/002_rw.up.sql migrations/003_providers.down.sql migrations/003_providers.up.sql migrations/004_status_enums.down.sql migrations/004_status_enums.up.sql migrations/005_payload_size.down.sql migrations/005_payload_size.up.sql migrations/006_add_dealstartoffset.down.sql migrations/006_add_dealstartoffset.up.sql migrations/007_piececididx.down.sql migrations/007_piececididx.up.sql
|
Package migrations generated by go-bindata.// sources: migrations/001_init.down.sql migrations/001_init.up.sql migrations/002_rw.down.sql migrations/002_rw.up.sql migrations/003_providers.down.sql migrations/003_providers.up.sql migrations/004_status_enums.down.sql migrations/004_status_enums.up.sql migrations/005_payload_size.down.sql migrations/005_payload_size.up.sql migrations/006_add_dealstartoffset.down.sql migrations/006_add_dealstartoffset.up.sql migrations/007_piececididx.down.sql migrations/007_piececididx.up.sql |