Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type DB
- func (db *DB) Bandwidth() bandwidth.DB
- func (db *DB) Close() error
- func (db *DB) CreateTables(ctx context.Context) error
- func (db *DB) Migration(ctx context.Context) *migrate.Migration
- func (db *DB) Notifications() notifications.DB
- func (db *DB) Orders() orders.DB
- func (db *DB) PieceExpirationDB() pieces.PieceExpirationDB
- func (db *DB) PieceSpaceUsedDB() pieces.PieceSpaceUsedDB
- func (db *DB) Pieces() storage.Blobs
- func (db *DB) RawDatabases() map[string]DBContainer
- func (db *DB) Reputation() reputation.DB
- func (db *DB) Satellites() satellites.DB
- func (db *DB) StorageUsage() storageusage.DB
- func (db *DB) UsedSerials() piecestore.UsedSerials
- func (db *DB) V0PieceInfo() pieces.V0PieceInfoDB
- type DBContainer
- type SQLDB
Constants ¶
const BandwidthDBName = "bandwidth"
BandwidthDBName represents the database name.
const DeprecatedInfoDBName = "info"
DeprecatedInfoDBName represents the database name.
const NotificationsDBName = "notifications"
NotificationsDBName represents the database name.
const OrdersDBName = "orders"
OrdersDBName represents the database name.
const PieceExpirationDBName = "piece_expiration"
PieceExpirationDBName represents the database filename.
const PieceInfoDBName = "pieceinfo"
PieceInfoDBName represents the database name.
const PieceSpaceUsedDBName = "piece_spaced_used"
PieceSpaceUsedDBName represents the database name.
const ReputationDBName = "reputation"
ReputationDBName represents the database name.
const SatellitesDBName = "satellites"
SatellitesDBName represents the database name.
const StorageUsageDBName = "storage_usage"
StorageUsageDBName represents the database name.
const UsedSerialsDBName = "used_serial"
UsedSerialsDBName represents the database name.
const VersionTable = "versions"
VersionTable is the table that stores the version info in each db
Variables ¶
var ( // ErrDatabase represents errors from the databases. ErrDatabase = errs.Class("storage node database error") // ErrNoRows represents database error if rows weren't affected. ErrNoRows = errs.New("no rows affected") )
var ErrBandwidth = errs.Class("bandwidthdb error")
ErrBandwidth represents errors from the bandwidthdb database.
var ErrNotificationsDB = errs.Class("notificationsDB error")
ErrNotificationsDB represents errors from the notifications database.
var ErrOrders = errs.Class("ordersdb error")
ErrOrders represents errors from the ordersdb database.
var ErrPieceExpiration = errs.Class("piece expiration error")
ErrPieceExpiration represents errors from the piece expiration database.
var ErrPieceInfo = errs.Class("v0pieceinfodb error")
ErrPieceInfo represents errors from the piece info database.
var ErrPieceSpaceUsed = errs.Class("piece space used error")
ErrPieceSpaceUsed represents errors from the piece spaced used database.
var ErrReputation = errs.Class("reputation error")
ErrReputation represents errors from the reputation database.
var ErrSatellitesDB = errs.Class("satellitesdb error")
ErrSatellitesDB represents errors from the satellites database.
var ErrUsedSerials = errs.Class("usedserialsdb error")
ErrUsedSerials represents errors from the used serials database.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // TODO: figure out better names Storage string Info string Info2 string Driver string // if unset, uses sqlite3 Pieces string }
Config configures storage node database
type DB ¶
type DB struct { SQLDBs map[string]DBContainer // contains filtered or unexported fields }
DB contains access to different database tables
func (*DB) CreateTables ¶
CreateTables creates any necessary tables.
func (*DB) Notifications ¶ added in v0.28.0
func (db *DB) Notifications() notifications.DB
Notifications returns the instance of the Notifications database.
func (*DB) PieceExpirationDB ¶ added in v0.18.0
func (db *DB) PieceExpirationDB() pieces.PieceExpirationDB
PieceExpirationDB returns the instance of the PieceExpiration database.
func (*DB) PieceSpaceUsedDB ¶ added in v0.18.0
func (db *DB) PieceSpaceUsedDB() pieces.PieceSpaceUsedDB
PieceSpaceUsedDB returns the instance of the PieceSpacedUsed database.
func (*DB) RawDatabases ¶ added in v0.21.0
func (db *DB) RawDatabases() map[string]DBContainer
RawDatabases are required for testing purposes
func (*DB) Reputation ¶ added in v0.18.0
func (db *DB) Reputation() reputation.DB
Reputation returns the instance of the Reputation database.
func (*DB) Satellites ¶ added in v0.22.0
func (db *DB) Satellites() satellites.DB
Satellites returns the instance of the Satellites database.
func (*DB) StorageUsage ¶ added in v0.18.0
func (db *DB) StorageUsage() storageusage.DB
StorageUsage returns the instance of the StorageUsage database.
func (*DB) UsedSerials ¶
func (db *DB) UsedSerials() piecestore.UsedSerials
UsedSerials returns the instance of the UsedSerials database.
func (*DB) V0PieceInfo ¶ added in v0.18.0
func (db *DB) V0PieceInfo() pieces.V0PieceInfoDB
V0PieceInfo returns the instance of the V0PieceInfoDB database.
type DBContainer ¶ added in v0.28.0
DBContainer defines an interface to allow accessing and setting a SQLDB
type SQLDB ¶ added in v0.16.0
type SQLDB interface { Close() error Begin() (*sql.Tx, error) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) Conn(ctx context.Context) (*sql.Conn, error) Driver() driver.Driver Exec(query string, args ...interface{}) (sql.Result, error) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) Query(query string, args ...interface{}) (*sql.Rows, error) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) QueryRow(query string, args ...interface{}) *sql.Row QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row }
SQLDB is an abstract database so that we can mock out what database implementation we're using.