db

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	ID                         broker.BatchID     `json:"id"`
	RepFactor                  int                `json:"repFactor"`
	DealDuration               int                `json:"dealDuration"`
	PayloadCid                 string             `json:"payloadCid"`
	PieceCid                   string             `json:"pieceCid"`
	PieceSize                  uint64             `json:"pieceSize"`
	CarUrl                     string             `json:"carUrl"`
	CarIpfsCid                 string             `json:"carIpfsCid"`
	CarIpfsAddrs               string             `json:"carIpfsAddrs"`
	DisallowRebatching         bool               `json:"disallowRebatching"`
	FilEpochDeadline           uint64             `json:"filEpochDeadline"`
	Error                      string             `json:"error"`
	Origin                     string             `json:"origin"`
	CreatedAt                  time.Time          `json:"createdAt"`
	UpdatedAt                  time.Time          `json:"updatedAt"`
	Providers                  []string           `json:"providers"`
	Status                     broker.BatchStatus `json:"status"`
	PayloadSize                sql.NullInt64      `json:"payloadSize"`
	ProposalStartOffsetSeconds int64              `json:"proposalStartOffsetSeconds"`
}

type BatchManifest

type BatchManifest struct {
	BatchID  string `json:"batchID"`
	Manifest []byte `json:"manifest"`
}

type BatchRemoteWallet

type BatchRemoteWallet struct {
	BatchID    broker.BatchID `json:"batchID"`
	PeerID     string         `json:"peerID"`
	AuthToken  string         `json:"authToken"`
	WalletAddr string         `json:"walletAddr"`
	Multiaddrs []string       `json:"multiaddrs"`
	CreatedAt  time.Time      `json:"createdAt"`
	UpdatedAt  time.Time      `json:"updatedAt"`
}

type BatchStatus

type BatchStatus string

@enum @enumName StoragePayloadStatus

const (
	BatchStatusUnknown    BatchStatus = "unknown"
	BatchStatusPreparing  BatchStatus = "preparing"
	BatchStatusAuctioning BatchStatus = "auctioning"
	BatchStatusDealMaking BatchStatus = "deal_making"
	BatchStatusSuccess    BatchStatus = "success"
	BatchStatusError      BatchStatus = "error"
)

func (*BatchStatus) Scan

func (e *BatchStatus) Scan(src interface{}) error

type BatchTag

type BatchTag struct {
	BatchID   broker.BatchID `json:"batchID"`
	Key       string         `json:"key"`
	Value     string         `json:"value"`
	CreatedAt time.Time      `json:"createdAt"`
}

type BatchUpdateStorageRequestsParams

type BatchUpdateStorageRequestsParams struct {
	Status  broker.StorageRequestStatus `json:"status"`
	BatchID sql.NullString              `json:"batchID"`
	Ids     []string                    `json:"ids"`
}

type CreateBatchManifestParams

type CreateBatchManifestParams struct {
	BatchID  string `json:"batchID"`
	Manifest []byte `json:"manifest"`
}

type CreateBatchParams

type CreateBatchParams struct {
	ID                         broker.BatchID     `json:"id"`
	Status                     broker.BatchStatus `json:"status"`
	RepFactor                  int                `json:"repFactor"`
	DealDuration               int                `json:"dealDuration"`
	CarUrl                     string             `json:"carUrl"`
	CarIpfsCid                 string             `json:"carIpfsCid"`
	CarIpfsAddrs               string             `json:"carIpfsAddrs"`
	DisallowRebatching         bool               `json:"disallowRebatching"`
	FilEpochDeadline           uint64             `json:"filEpochDeadline"`
	ProposalStartOffsetSeconds int64              `json:"proposalStartOffsetSeconds"`
	Error                      string             `json:"error"`
	PayloadCid                 string             `json:"payloadCid"`
	PayloadSize                sql.NullInt64      `json:"payloadSize"`
	PieceCid                   string             `json:"pieceCid"`
	PieceSize                  uint64             `json:"pieceSize"`
	Origin                     string             `json:"origin"`
	Providers                  []string           `json:"providers"`
}

type CreateBatchRemoteWalletParams

type CreateBatchRemoteWalletParams struct {
	BatchID    broker.BatchID `json:"batchID"`
	PeerID     string         `json:"peerID"`
	AuthToken  string         `json:"authToken"`
	WalletAddr string         `json:"walletAddr"`
	Multiaddrs []string       `json:"multiaddrs"`
}

type CreateBatchTagParams

type CreateBatchTagParams struct {
	BatchID broker.BatchID `json:"batchID"`
	Key     string         `json:"key"`
	Value   string         `json:"value"`
}

type CreateDealParams

type CreateDealParams struct {
	BatchID           broker.BatchID `json:"batchID"`
	AuctionID         auction.ID     `json:"auctionID"`
	BidID             auction.BidID  `json:"bidID"`
	StorageProviderID string         `json:"storageProviderID"`
	DealID            int64          `json:"dealID"`
	DealExpiration    uint64         `json:"dealExpiration"`
	ErrorCause        string         `json:"errorCause"`
}

type CreateStorageRequestParams

type CreateStorageRequestParams struct {
	ID      broker.StorageRequestID     `json:"id"`
	DataCid string                      `json:"dataCid"`
	Status  broker.StorageRequestStatus `json:"status"`
	Origin  string                      `json:"origin"`
}

type CreateUnpinJobParams

type CreateUnpinJobParams struct {
	ID   string `json:"id"`
	Cid  string `json:"cid"`
	Type int16  `json:"type"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Deal

type Deal struct {
	BatchID           broker.BatchID `json:"batchID"`
	AuctionID         auction.ID     `json:"auctionID"`
	BidID             auction.BidID  `json:"bidID"`
	StorageProviderID string         `json:"storageProviderID"`
	DealID            int64          `json:"dealID"`
	DealExpiration    uint64         `json:"dealExpiration"`
	ErrorCause        string         `json:"errorCause"`
	CreatedAt         time.Time      `json:"createdAt"`
	UpdatedAt         time.Time      `json:"updatedAt"`
}

type GetExcludedStorageProvidersParams

type GetExcludedStorageProvidersParams struct {
	PieceCid string `json:"pieceCid"`
	Origin   string `json:"origin"`
}

type Operation

type Operation struct {
	ID        string    `json:"id"`
	CreatedAt time.Time `json:"createdAt"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func Prepare

func Prepare(ctx context.Context, db DBTX) (*Queries, error)

func (*Queries) BatchUpdateStorageRequests

func (q *Queries) BatchUpdateStorageRequests(ctx context.Context, arg BatchUpdateStorageRequestsParams) ([]broker.StorageRequestID, error)

func (*Queries) Close

func (q *Queries) Close() error

func (*Queries) CreateBatch

func (q *Queries) CreateBatch(ctx context.Context, arg CreateBatchParams) error

func (*Queries) CreateBatchManifest

func (q *Queries) CreateBatchManifest(ctx context.Context, arg CreateBatchManifestParams) error

func (*Queries) CreateBatchRemoteWallet

func (q *Queries) CreateBatchRemoteWallet(ctx context.Context, arg CreateBatchRemoteWalletParams) error

func (*Queries) CreateBatchTag

func (q *Queries) CreateBatchTag(ctx context.Context, arg CreateBatchTagParams) error

func (*Queries) CreateDeal

func (q *Queries) CreateDeal(ctx context.Context, arg CreateDealParams) error

func (*Queries) CreateOperation

func (q *Queries) CreateOperation(ctx context.Context, id string) error

func (*Queries) CreateStorageRequest

func (q *Queries) CreateStorageRequest(ctx context.Context, arg CreateStorageRequestParams) error

func (*Queries) CreateUnpinJob

func (q *Queries) CreateUnpinJob(ctx context.Context, arg CreateUnpinJobParams) error

func (*Queries) DeleteExecutingUnpinJob

func (q *Queries) DeleteExecutingUnpinJob(ctx context.Context, id string) error

func (*Queries) GetBatch

func (q *Queries) GetBatch(ctx context.Context, id broker.BatchID) (Batch, error)

func (*Queries) GetBatchManifest

func (q *Queries) GetBatchManifest(ctx context.Context, batchID string) (BatchManifest, error)

func (*Queries) GetBatchRemoteWallet

func (q *Queries) GetBatchRemoteWallet(ctx context.Context, batchID broker.BatchID) (BatchRemoteWallet, error)

func (*Queries) GetBatchTags

func (q *Queries) GetBatchTags(ctx context.Context, batchID broker.BatchID) ([]BatchTag, error)

func (*Queries) GetDeals

func (q *Queries) GetDeals(ctx context.Context, batchID broker.BatchID) ([]Deal, error)

func (*Queries) GetExcludedStorageProviders

func (q *Queries) GetExcludedStorageProviders(ctx context.Context, arg GetExcludedStorageProvidersParams) ([]string, error)

func (*Queries) GetStorageRequest

func (q *Queries) GetStorageRequest(ctx context.Context, id broker.StorageRequestID) (StorageRequest, error)

func (*Queries) GetStorageRequestIDs

func (q *Queries) GetStorageRequestIDs(ctx context.Context, batchID sql.NullString) ([]broker.StorageRequestID, error)

func (*Queries) GetStorageRequests

func (q *Queries) GetStorageRequests(ctx context.Context, batchID sql.NullString) ([]StorageRequest, error)

func (*Queries) NextUnpinJob

func (q *Queries) NextUnpinJob(ctx context.Context, stuckSeconds int64) (UnpinJob, error)

func (*Queries) RebatchStorageRequests

func (q *Queries) RebatchStorageRequests(ctx context.Context, arg RebatchStorageRequestsParams) error

func (*Queries) UnpinJobToPending

func (q *Queries) UnpinJobToPending(ctx context.Context, arg UnpinJobToPendingParams) error

func (*Queries) UpdateBatch

func (q *Queries) UpdateBatch(ctx context.Context, arg UpdateBatchParams) error

func (*Queries) UpdateBatchStatus

func (q *Queries) UpdateBatchStatus(ctx context.Context, arg UpdateBatchStatusParams) error

func (*Queries) UpdateBatchStatusAndError

func (q *Queries) UpdateBatchStatusAndError(ctx context.Context, arg UpdateBatchStatusAndErrorParams) error

func (*Queries) UpdateDeals

func (q *Queries) UpdateDeals(ctx context.Context, arg UpdateDealsParams) (int64, error)

func (*Queries) UpdateStorageRequestsStatus

func (q *Queries) UpdateStorageRequestsStatus(ctx context.Context, arg UpdateStorageRequestsStatusParams) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type RebatchStorageRequestsParams

type RebatchStorageRequestsParams struct {
	BatchID    sql.NullString `json:"batchID"`
	ErrorCause string         `json:"errorCause"`
}

type StorageRequest

type StorageRequest struct {
	ID           broker.StorageRequestID     `json:"id"`
	DataCid      string                      `json:"dataCid"`
	BatchID      sql.NullString              `json:"batchID"`
	Origin       string                      `json:"origin"`
	RebatchCount int32                       `json:"rebatchCount"`
	ErrorCause   string                      `json:"errorCause"`
	CreatedAt    time.Time                   `json:"createdAt"`
	UpdatedAt    time.Time                   `json:"updatedAt"`
	Status       broker.StorageRequestStatus `json:"status"`
}

type StorageRequestStatus

type StorageRequestStatus string
const (
	StorageRequestStatusUnknown    StorageRequestStatus = "unknown"
	StorageRequestStatusBatching   StorageRequestStatus = "batching"
	StorageRequestStatusPreparing  StorageRequestStatus = "preparing"
	StorageRequestStatusAuctioning StorageRequestStatus = "auctioning"
	StorageRequestStatusDealMaking StorageRequestStatus = "deal_making"
	StorageRequestStatusSuccess    StorageRequestStatus = "success"
	StorageRequestStatusError      StorageRequestStatus = "error"
)

func (*StorageRequestStatus) Scan

func (e *StorageRequestStatus) Scan(src interface{}) error

type UnpinJob

type UnpinJob struct {
	ID        string       `json:"id"`
	Executing sql.NullBool `json:"executing"`
	Cid       string       `json:"cid"`
	Type      int16        `json:"type"`
	ReadyAt   time.Time    `json:"readyAt"`
	CreatedAt time.Time    `json:"createdAt"`
	UpdatedAt time.Time    `json:"updatedAt"`
}

type UnpinJobToPendingParams

type UnpinJobToPendingParams struct {
	ID      string    `json:"id"`
	ReadyAt time.Time `json:"readyAt"`
}

type UpdateBatchParams

type UpdateBatchParams struct {
	ID        broker.BatchID     `json:"id"`
	Status    broker.BatchStatus `json:"status"`
	PieceCid  string             `json:"pieceCid"`
	PieceSize uint64             `json:"pieceSize"`
}

type UpdateBatchStatusAndErrorParams

type UpdateBatchStatusAndErrorParams struct {
	ID     broker.BatchID     `json:"id"`
	Status broker.BatchStatus `json:"status"`
	Error  string             `json:"error"`
}

type UpdateBatchStatusParams

type UpdateBatchStatusParams struct {
	ID     broker.BatchID     `json:"id"`
	Status broker.BatchStatus `json:"status"`
}

type UpdateDealsParams

type UpdateDealsParams struct {
	BatchID           broker.BatchID `json:"batchID"`
	StorageProviderID string         `json:"storageProviderID"`
	DealID            int64          `json:"dealID"`
	DealExpiration    uint64         `json:"dealExpiration"`
	ErrorCause        string         `json:"errorCause"`
}

type UpdateStorageRequestsStatusParams

type UpdateStorageRequestsStatusParams struct {
	BatchID sql.NullString              `json:"batchID"`
	Status  broker.StorageRequestStatus `json:"status"`
}

Jump to

Keyboard shortcuts

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