db

package
v1.0.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0, MIT Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

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 LoadFixtures

func LoadFixtures(ctx context.Context, db *sql.DB) ([]types.ProviderDealState, error)

func Migrate

func Migrate(db *sql.DB) 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) ByPublishCID

func (d *DealsDB) ByPublishCID(ctx context.Context, publishCid string) ([]*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) (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, 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 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) 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 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) error

func (*StorageDB) TotalTagged

func (s *StorageDB) TotalTagged(ctx context.Context) (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