db

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: Apache-2.0, MIT Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const DealsDBName = "boost.db"
View Source
const LogsDBName = "boost.logs.db"

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func CreateAllBoostTables

func CreateAllBoostTables(ctx context.Context, mainDB *sql.DB, logsDB *sql.DB) error

func CreateTestTmpDB

func CreateTestTmpDB(t *testing.T) *sql.DB

func GenerateDeals

func GenerateDeals() ([]types.ProviderDealState, error)

func GenerateNDeals added in v1.4.0

func GenerateNDeals(count int) ([]types.ProviderDealState, error)

func SqlBackup added in v1.6.1

func SqlBackup(ctx context.Context, srcDB *sql.DB, dstDir, dbFileName string) error

func SqlDB

func SqlDB(dbPath string) (*sql.DB, error)

Types

type DealLog

type DealLog struct {
	DealUUID  uuid.UUID
	CreatedAt time.Time
	LogLevel  string
	LogMsg    string
	LogParams string
	Subsystem string
}

type DealsDB

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

func NewDealsDB

func NewDealsDB(db *sql.DB) *DealsDB

func (*DealsDB) ByID

func (*DealsDB) ByPieceCID added in v1.2.0

func (d *DealsDB) ByPieceCID(ctx context.Context, pieceCid cid.Cid) ([]*types.ProviderDealState, error)

func (*DealsDB) ByPublishCID

func (d *DealsDB) ByPublishCID(ctx context.Context, publishCid string) ([]*types.ProviderDealState, error)

func (*DealsDB) ByRootPayloadCID added in v1.2.0

func (d *DealsDB) ByRootPayloadCID(ctx context.Context, payloadCid cid.Cid) ([]*types.ProviderDealState, error)

func (*DealsDB) BySectorID added in v1.7.0

func (d *DealsDB) BySectorID(ctx context.Context, sectorID abi.SectorID) ([]*types.ProviderDealState, error)

func (*DealsDB) BySignedProposalCID

func (d *DealsDB) BySignedProposalCID(ctx context.Context, proposalCid cid.Cid) (*types.ProviderDealState, error)

func (*DealsDB) Count

func (d *DealsDB) Count(ctx context.Context, query string, filter *FilterOptions) (int, error)

func (*DealsDB) Insert

func (d *DealsDB) Insert(ctx context.Context, deal *types.ProviderDealState) error

func (*DealsDB) List

func (d *DealsDB) List(ctx context.Context, query string, filter *FilterOptions, cursor *graphql.ID, offset int, limit int) ([]*types.ProviderDealState, error)

func (*DealsDB) ListActive

func (d *DealsDB) ListActive(ctx context.Context) ([]*types.ProviderDealState, error)

func (*DealsDB) ListCompleted

func (d *DealsDB) ListCompleted(ctx context.Context) ([]*types.ProviderDealState, error)

func (*DealsDB) Update

func (d *DealsDB) Update(ctx context.Context, deal *types.ProviderDealState) error

type FilterOptions added in v1.5.1

type FilterOptions struct {
	Checkpoint   *string
	IsOffline    *bool
	TransferType *string
	IsVerified   *bool
}

type FundsDB

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

func NewFundsDB

func NewFundsDB(db *sql.DB) *FundsDB

func (*FundsDB) InsertLog

func (f *FundsDB) InsertLog(ctx context.Context, logs ...*FundsLog) error

func (*FundsDB) Logs

func (f *FundsDB) Logs(ctx context.Context, cursor *time.Time, offset int, limit int) ([]FundsLog, error)

func (*FundsDB) LogsCount

func (f *FundsDB) LogsCount(ctx context.Context) (int, error)

func (*FundsDB) Tag

func (f *FundsDB) Tag(ctx context.Context, dealUuid uuid.UUID, collateral abi.TokenAmount, pubMsg abi.TokenAmount) error

func (*FundsDB) TotalTagged

func (f *FundsDB) TotalTagged(ctx context.Context) (*TotalTagged, error)

func (*FundsDB) Untag

func (f *FundsDB) Untag(ctx context.Context, dealUuid uuid.UUID) (clt abi.TokenAmount, pub abi.TokenAmount, e error)

type FundsLog

type FundsLog struct {
	DealUUID  uuid.UUID
	CreatedAt time.Time
	Amount    big.Int
	Text      string
}

type LogsDB

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

func NewLogsDB

func NewLogsDB(db *sql.DB) *LogsDB

func (*LogsDB) CleanupLogs added in v1.5.1

func (d *LogsDB) CleanupLogs(ctx context.Context, daysOld int) error

func (*LogsDB) InsertLog

func (d *LogsDB) InsertLog(ctx context.Context, l *DealLog) error

func (*LogsDB) Logs

func (d *LogsDB) Logs(ctx context.Context, dealID uuid.UUID) ([]DealLog, error)

type ProposalLog

type ProposalLog struct {
	DealUUID      uuid.UUID
	Accepted      bool
	Reason        string
	CreatedAt     time.Time
	ClientAddress address.Address
	PieceSize     abi.PaddedPieceSize
}

type ProposalLogsDB

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

func NewProposalLogsDB

func NewProposalLogsDB(db *sql.DB) *ProposalLogsDB

func (*ProposalLogsDB) Count

func (p *ProposalLogsDB) Count(ctx context.Context, accepted *bool) (int, error)

func (*ProposalLogsDB) DeleteOlderThan

func (p *ProposalLogsDB) DeleteOlderThan(ctx context.Context, at time.Time) (int64, error)

func (*ProposalLogsDB) InsertLog

func (p *ProposalLogsDB) InsertLog(ctx context.Context, deal types.DealParams, accepted bool, reason string) error

func (*ProposalLogsDB) List

func (p *ProposalLogsDB) List(ctx context.Context, accepted *bool, cursor *time.Time, offset int, limit int) ([]ProposalLog, error)

type Scannable

type Scannable interface {
	Scan(dest ...interface{}) error
}

type SealState added in v1.7.0

type SealState string
const SealStateCache SealState = "Cache"
const SealStateRemoved SealState = "Removed"
const SealStateSealed SealState = "Sealed"
const SealStateUnsealed SealState = "Unsealed"

type SectorState added in v1.7.0

type SectorState struct {
	SectorID  abi.SectorID
	UpdatedAt time.Time
	SealState SealState
}

type SectorStateDB added in v1.7.0

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

func NewSectorStateDB added in v1.7.0

func NewSectorStateDB(db *sql.DB) *SectorStateDB

func (*SectorStateDB) List added in v1.7.0

func (sdb *SectorStateDB) List(ctx context.Context) ([]SectorState, error)

func (*SectorStateDB) Update added in v1.7.0

func (sdb *SectorStateDB) Update(ctx context.Context, sectorID abi.SectorID, SealState SealState) error

type StorageDB

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

func NewStorageDB

func NewStorageDB(db *sql.DB) *StorageDB

func (*StorageDB) InsertLog

func (s *StorageDB) InsertLog(ctx context.Context, logs ...*StorageLog) error

func (*StorageDB) Logs

func (s *StorageDB) Logs(ctx context.Context) ([]StorageLog, error)

func (*StorageDB) Tag

func (s *StorageDB) Tag(ctx context.Context, dealUuid uuid.UUID, size uint64, host string) error

func (*StorageDB) TotalTagged

func (s *StorageDB) TotalTagged(ctx context.Context) (uint64, error)

func (*StorageDB) TotalTaggedForHost added in v1.4.0

func (s *StorageDB) TotalTaggedForHost(ctx context.Context, host string) (uint64, error)

func (*StorageDB) Untag

func (s *StorageDB) Untag(ctx context.Context, dealUuid uuid.UUID) (uint64, error)

type StorageLog

type StorageLog struct {
	DealUUID     uuid.UUID
	CreatedAt    time.Time
	TransferSize uint64
	Text         string
}

type TotalTagged

type TotalTagged struct {
	Collateral abi.TokenAmount
	PubMsg     abi.TokenAmount
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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