Documentation ¶
Index ¶
- Variables
- func New(log *zap.Logger, databaseURL string) (satellite.DB, error)
- func NewInMemory(log *zap.Logger) (satellite.DB, error)
- type ConsoleDB
- func (db *ConsoleDB) APIKeys() console.APIKeys
- func (db *ConsoleDB) BeginTx(ctx context.Context) (console.DBTx, error)
- func (db *ConsoleDB) BucketUsage() accounting.BucketUsage
- func (db *ConsoleDB) ProjectInvoiceStamps() console.ProjectInvoiceStamps
- func (db *ConsoleDB) ProjectMembers() console.ProjectMembers
- func (db *ConsoleDB) ProjectPayments() console.ProjectPayments
- func (db *ConsoleDB) Projects() console.Projects
- func (db *ConsoleDB) RegistrationTokens() console.RegistrationTokens
- func (db *ConsoleDB) ResetPasswordTokens() console.ResetPasswordTokens
- func (db *ConsoleDB) UsageRollups() console.UsageRollups
- func (db *ConsoleDB) UserCredits() console.UserCredits
- func (db *ConsoleDB) UserPayments() console.UserPayments
- func (db *ConsoleDB) Users() console.Users
- type DB
- func (db *DB) Attribution() attribution.DB
- func (db *DB) Buckets() metainfo.BucketsDB
- func (db *DB) CertDB() certdb.DB
- func (db *DB) Close() error
- func (db *DB) Console() console.DB
- func (db *DB) Containment() audit.Containment
- func (db *DB) CreateSchema(schema string) error
- func (db *DB) CreateTables() error
- func (db *DB) DropSchema(schema string) error
- func (db *DB) Irreparable() irreparable.DB
- func (db *DB) Orders() orders.DB
- func (db *DB) OverlayCache() overlay.DB
- func (db *DB) PostgresMigration() *migrate.Migration
- func (db *DB) ProjectAccounting() accounting.ProjectAccounting
- func (db *DB) RepairQueue() queue.RepairQueue
- func (db *DB) Rewards() rewards.DB
- func (db *DB) StoragenodeAccounting() accounting.StoragenodeAccounting
- func (db *DB) TestDBAccess() *dbx.DB
- type DBTx
- type ProjectAccounting
- func (db *ProjectAccounting) CreateStorageTally(ctx context.Context, tally accounting.BucketStorageTally) (err error)
- func (db *ProjectAccounting) GetAllocatedBandwidthTotal(ctx context.Context, projectID uuid.UUID, from time.Time) (_ int64, err error)
- func (db *ProjectAccounting) GetProjectUsageLimits(ctx context.Context, projectID uuid.UUID) (_ memory.Size, err error)
- func (db *ProjectAccounting) GetStorageTotals(ctx context.Context, projectID uuid.UUID) (inline int64, remote int64, err error)
- func (db *ProjectAccounting) SaveTallies(ctx context.Context, intervalStart time.Time, ...) (_ []accounting.BucketTally, err error)
- type StoragenodeAccounting
- func (db *StoragenodeAccounting) DeleteTalliesBefore(ctx context.Context, latestRollup time.Time) (err error)
- func (db *StoragenodeAccounting) GetBandwidthSince(ctx context.Context, latestRollup time.Time) (_ []*accounting.StoragenodeBandwidthRollup, err error)
- func (db *StoragenodeAccounting) GetTallies(ctx context.Context) (_ []*accounting.StoragenodeStorageTally, err error)
- func (db *StoragenodeAccounting) GetTalliesSince(ctx context.Context, latestRollup time.Time) (_ []*accounting.StoragenodeStorageTally, err error)
- func (db *StoragenodeAccounting) LastTimestamp(ctx context.Context, timestampType string) (_ time.Time, err error)
- func (db *StoragenodeAccounting) QueryNodeDailySpaceUsage(ctx context.Context, nodeID storj.NodeID, start time.Time, end time.Time) (_ []accounting.NodeSpaceUsage, err error)
- func (db *StoragenodeAccounting) QueryPaymentInfo(ctx context.Context, start time.Time, end time.Time) (_ []*accounting.CSVRow, err error)
- func (db *StoragenodeAccounting) SaveRollup(ctx context.Context, latestRollup time.Time, stats accounting.RollupStats) (err error)
- func (db *StoragenodeAccounting) SaveTallies(ctx context.Context, latestTally time.Time, nodeData map[storj.NodeID]float64) (err error)
Constants ¶
This section is empty.
Variables ¶
var ErrMigrate = errs.Class("migrate")
ErrMigrate is for tracking migration errors
var ( // Error is the default satellitedb errs class Error = errs.Class("satellitedb") )
Functions ¶
Types ¶
type ConsoleDB ¶
type ConsoleDB struct {
// contains filtered or unexported fields
}
ConsoleDB contains access to different satellite databases
func (*ConsoleDB) BucketUsage ¶
func (db *ConsoleDB) BucketUsage() accounting.BucketUsage
BucketUsage is a getter for accounting.BucketUsage repository
func (*ConsoleDB) ProjectInvoiceStamps ¶ added in v0.13.0
func (db *ConsoleDB) ProjectInvoiceStamps() console.ProjectInvoiceStamps
ProjectInvoiceStamps is a getter for console.ProjectInvoiceStamps repository
func (*ConsoleDB) ProjectMembers ¶
func (db *ConsoleDB) ProjectMembers() console.ProjectMembers
ProjectMembers is a getter for ProjectMembers repository
func (*ConsoleDB) ProjectPayments ¶ added in v0.13.0
func (db *ConsoleDB) ProjectPayments() console.ProjectPayments
ProjectPayments is a getter for console.ProjectPayments repository
func (*ConsoleDB) RegistrationTokens ¶
func (db *ConsoleDB) RegistrationTokens() console.RegistrationTokens
RegistrationTokens is a getter for RegistrationTokens repository
func (*ConsoleDB) ResetPasswordTokens ¶ added in v0.12.0
func (db *ConsoleDB) ResetPasswordTokens() console.ResetPasswordTokens
ResetPasswordTokens is a getter for ResetPasswordTokens repository
func (*ConsoleDB) UsageRollups ¶ added in v0.9.0
func (db *ConsoleDB) UsageRollups() console.UsageRollups
UsageRollups is a getter for console.UsageRollups repository
func (*ConsoleDB) UserCredits ¶ added in v0.14.0
func (db *ConsoleDB) UserCredits() console.UserCredits
UserCredits is a getter for console.UserCredits repository
func (*ConsoleDB) UserPayments ¶ added in v0.13.0
func (db *ConsoleDB) UserPayments() console.UserPayments
UserPayments is a getter for console.UserPayments repository
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB contains access to different database tables
func (*DB) Attribution ¶ added in v0.14.0
func (db *DB) Attribution() attribution.DB
Attribution is a getter for value attribution repository
func (*DB) Containment ¶ added in v0.12.0
func (db *DB) Containment() audit.Containment
Containment returns database for storing pending audit info
func (*DB) CreateSchema ¶
CreateSchema creates a schema if it doesn't exist.
func (*DB) CreateTables ¶
CreateTables is a method for creating all tables for database
func (*DB) DropSchema ¶
DropSchema drops the named schema
func (*DB) Irreparable ¶
func (db *DB) Irreparable() irreparable.DB
Irreparable returns database for storing segments that failed repair
func (*DB) OverlayCache ¶
OverlayCache is a getter for overlay cache repository
func (*DB) PostgresMigration ¶
PostgresMigration returns steps needed for migrating postgres database.
func (*DB) ProjectAccounting ¶ added in v0.12.0
func (db *DB) ProjectAccounting() accounting.ProjectAccounting
ProjectAccounting returns database for tracking project data use
func (*DB) RepairQueue ¶
func (db *DB) RepairQueue() queue.RepairQueue
RepairQueue is a getter for RepairQueue repository
func (*DB) StoragenodeAccounting ¶ added in v0.12.0
func (db *DB) StoragenodeAccounting() accounting.StoragenodeAccounting
StoragenodeAccounting returns database for tracking storagenode usage
func (*DB) TestDBAccess ¶
TestDBAccess for raw database access, should not be used outside of migration tests.
type DBTx ¶
type DBTx struct {
*ConsoleDB
}
DBTx extends Database with transaction scope
type ProjectAccounting ¶ added in v0.12.0
type ProjectAccounting struct {
// contains filtered or unexported fields
}
ProjectAccounting implements the accounting/db ProjectAccounting interface
func (*ProjectAccounting) CreateStorageTally ¶ added in v0.12.0
func (db *ProjectAccounting) CreateStorageTally(ctx context.Context, tally accounting.BucketStorageTally) (err error)
CreateStorageTally creates a record in the bucket_storage_tallies accounting table
func (*ProjectAccounting) GetAllocatedBandwidthTotal ¶ added in v0.12.0
func (db *ProjectAccounting) GetAllocatedBandwidthTotal(ctx context.Context, projectID uuid.UUID, from time.Time) (_ int64, err error)
GetAllocatedBandwidthTotal returns the sum of GET bandwidth usage allocated for a projectID for a time frame
func (*ProjectAccounting) GetProjectUsageLimits ¶ added in v0.13.0
func (db *ProjectAccounting) GetProjectUsageLimits(ctx context.Context, projectID uuid.UUID) (_ memory.Size, err error)
GetProjectUsageLimits returns project usage limit
func (*ProjectAccounting) GetStorageTotals ¶ added in v0.12.0
func (db *ProjectAccounting) GetStorageTotals(ctx context.Context, projectID uuid.UUID) (inline int64, remote int64, err error)
GetStorageTotals returns the current inline and remote storage usage for a projectID
func (*ProjectAccounting) SaveTallies ¶ added in v0.12.0
func (db *ProjectAccounting) SaveTallies(ctx context.Context, intervalStart time.Time, bucketTallies map[string]*accounting.BucketTally) (_ []accounting.BucketTally, err error)
SaveTallies saves the latest bucket info
type StoragenodeAccounting ¶ added in v0.12.0
type StoragenodeAccounting struct {
// contains filtered or unexported fields
}
StoragenodeAccounting implements the accounting/db StoragenodeAccounting interface
func (*StoragenodeAccounting) DeleteTalliesBefore ¶ added in v0.12.0
func (db *StoragenodeAccounting) DeleteTalliesBefore(ctx context.Context, latestRollup time.Time) (err error)
DeleteTalliesBefore deletes all raw tallies prior to some time
func (*StoragenodeAccounting) GetBandwidthSince ¶ added in v0.12.0
func (db *StoragenodeAccounting) GetBandwidthSince(ctx context.Context, latestRollup time.Time) (_ []*accounting.StoragenodeBandwidthRollup, err error)
GetBandwidthSince retrieves all storagenode_bandwidth_rollup entires since latestRollup
func (*StoragenodeAccounting) GetTallies ¶ added in v0.12.0
func (db *StoragenodeAccounting) GetTallies(ctx context.Context) (_ []*accounting.StoragenodeStorageTally, err error)
GetTallies retrieves all raw tallies
func (*StoragenodeAccounting) GetTalliesSince ¶ added in v0.12.0
func (db *StoragenodeAccounting) GetTalliesSince(ctx context.Context, latestRollup time.Time) (_ []*accounting.StoragenodeStorageTally, err error)
GetTalliesSince retrieves all raw tallies since latestRollup
func (*StoragenodeAccounting) LastTimestamp ¶ added in v0.12.0
func (db *StoragenodeAccounting) LastTimestamp(ctx context.Context, timestampType string) (_ time.Time, err error)
LastTimestamp records the greatest last tallied time
func (*StoragenodeAccounting) QueryNodeDailySpaceUsage ¶ added in v0.15.0
func (db *StoragenodeAccounting) QueryNodeDailySpaceUsage(ctx context.Context, nodeID storj.NodeID, start time.Time, end time.Time) (_ []accounting.NodeSpaceUsage, err error)
QueryNodeDailySpaceUsage returns slice of NodeSpaceUsage for given period
func (*StoragenodeAccounting) QueryPaymentInfo ¶ added in v0.12.0
func (db *StoragenodeAccounting) QueryPaymentInfo(ctx context.Context, start time.Time, end time.Time) (_ []*accounting.CSVRow, err error)
QueryPaymentInfo queries Overlay, Accounting Rollup on nodeID
func (*StoragenodeAccounting) SaveRollup ¶ added in v0.12.0
func (db *StoragenodeAccounting) SaveRollup(ctx context.Context, latestRollup time.Time, stats accounting.RollupStats) (err error)
SaveRollup records raw tallies of at rest data to the database
Source Files ¶
- apikeys.go
- attribution.go
- buckets.go
- bucketusage.go
- certdb.go
- consoledb.go
- containment.go
- database.go
- irreparabledb.go
- locked.go
- lockedtx.go
- migrate.go
- offers.go
- orders.go
- overlaycache.go
- projectaccounting.go
- projectinvoicestamps.go
- projectmembers.go
- projectpaymentinfos.go
- projects.go
- regtokens.go
- repairqueue.go
- resetpasstokens.go
- storagenodeaccounting.go
- usagerollups.go
- usercredits.go
- userpayments.go
- users.go
- utils.go