Documentation ¶
Index ¶
- Constants
- Variables
- type Agreement
- type AgreementStatus
- type DB
- func (db *DB) AddTTL(id string, expiration, size int64) error
- func (db *DB) Begin() (*sql.Tx, error)
- func (db *DB) Close() error
- func (db *DB) DeleteBandwidthAllocationBySerialnum(serialnum string) error
- func (db *DB) DeleteBandwidthAllocationPayouts() error
- func (db *DB) DeleteExpired(ctx context.Context) (expired []string, err error)
- func (db *DB) DeleteTTLByID(id string) error
- func (db *DB) GetBandwidthAllocationBySignature(signature []byte) ([]*pb.Order, error)
- func (db *DB) GetBandwidthAllocations() (map[storj.NodeID][]*Agreement, error)
- func (db *DB) GetBandwidthUsedByDay(t time.Time) (size int64, err error)
- func (db *DB) GetBwaStatusBySerialNum(serialnum string) (status AgreementStatus, err error)
- func (db *DB) GetTTLByID(id string) (expiration int64, err error)
- func (db *DB) GetTotalBandwidthBetween(startdate time.Time, enddate time.Time) (int64, error)
- func (db *DB) Migration() *migrate.Migration
- func (db *DB) RawDB() *sql.DB
- func (db *DB) Rebind(s string) string
- func (db *DB) Schema() string
- func (db *DB) SumTTLSizes() (int64, error)
- func (db *DB) UpdateBandwidthAllocationStatus(serialnum string, status AgreementStatus) (err error)
- func (db *DB) WriteBandwidthAllocToDB(rba *pb.Order) error
Constants ¶
const ( // AgreementStatusUnsent sets the agreement status to UNSENT AgreementStatusUnsent = iota // AgreementStatusSent sets the agreement status to SENT AgreementStatusSent // AgreementStatusReject sets the agreement status to REJECT AgreementStatusReject )
Variables ¶
var ( // Error is the default psdb errs class Error = errs.Class("psdb") )
Functions ¶
This section is empty.
Types ¶
type Agreement ¶
Agreement is a struct that contains a bandwidth agreement and the associated signature
type AgreementStatus ¶
type AgreementStatus int32
AgreementStatus keep tracks of the agreement payout status
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a piece store database
func (*DB) DeleteBandwidthAllocationBySerialnum ¶
DeleteBandwidthAllocationBySerialnum finds an allocation by signature and deletes it
func (*DB) DeleteBandwidthAllocationPayouts ¶
DeleteBandwidthAllocationPayouts delete paid and/or old payout enteries based on days old
func (*DB) DeleteExpired ¶
DeleteExpired deletes expired pieces
func (*DB) DeleteTTLByID ¶
DeleteTTLByID finds the TTL in the database by id and delete it
func (*DB) GetBandwidthAllocationBySignature ¶
GetBandwidthAllocationBySignature finds allocation info by signature
func (*DB) GetBandwidthAllocations ¶
GetBandwidthAllocations all bandwidth agreements
func (*DB) GetBandwidthUsedByDay ¶
GetBandwidthUsedByDay finds the so far bw used by day and return it
func (*DB) GetBwaStatusBySerialNum ¶
func (db *DB) GetBwaStatusBySerialNum(serialnum string) (status AgreementStatus, err error)
GetBwaStatusBySerialNum get BWA status by serial num
func (*DB) GetTTLByID ¶
GetTTLByID finds the TTL in the database by id and return it
func (*DB) GetTotalBandwidthBetween ¶
GetTotalBandwidthBetween each row in the bwusagetbl contains the total bw used per day
func (*DB) SumTTLSizes ¶
SumTTLSizes sums the size column on the ttl table
func (*DB) UpdateBandwidthAllocationStatus ¶
func (db *DB) UpdateBandwidthAllocationStatus(serialnum string, status AgreementStatus) (err error)
UpdateBandwidthAllocationStatus update the bwa payout status