storagenodedb

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const BandwidthDBName = "bandwidth"

BandwidthDBName represents the database name.

View Source
const DeprecatedInfoDBName = "info"

DeprecatedInfoDBName represents the database name.

View Source
const HeldAmountDBName = "heldamount"

HeldAmountDBName represents the database name.

View Source
const NotificationsDBName = "notifications"

NotificationsDBName represents the database name.

View Source
const OrdersDBName = "orders"

OrdersDBName represents the database name.

View Source
const PieceExpirationDBName = "piece_expiration"

PieceExpirationDBName represents the database filename.

View Source
const PieceInfoDBName = "pieceinfo"

PieceInfoDBName represents the database name.

View Source
const PieceSpaceUsedDBName = "piece_spaced_used"

PieceSpaceUsedDBName represents the database name.

View Source
const PricingDBName = "pricing"

PricingDBName represents the database name.

View Source
const ReputationDBName = "reputation"

ReputationDBName represents the database name.

View Source
const SatellitesDBName = "satellites"

SatellitesDBName represents the database name.

View Source
const StorageUsageDBName = "storage_usage"

StorageUsageDBName represents the database name.

View Source
const UsedSerialsDBName = "used_serial"

UsedSerialsDBName represents the database name.

View Source
const VersionTable = "versions"

VersionTable is the table that stores the version info in each db

Variables

View Source
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")
	// ErrPreflight represents an error during the preflight check.
	ErrPreflight = errs.Class("storage node preflight database error")
)
View Source
var ErrBandwidth = errs.Class("bandwidthdb error")

ErrBandwidth represents errors from the bandwidthdb database.

View Source
var ErrHeldAmount = errs.Class("heldamount error")

ErrHeldAmount represents errors from the heldamount database.

View Source
var ErrNotificationsDB = errs.Class("notificationsDB error")

ErrNotificationsDB represents errors from the notifications database.

View Source
var ErrOrders = errs.Class("ordersdb error")

ErrOrders represents errors from the ordersdb database.

View Source
var ErrPieceExpiration = errs.Class("piece expiration error")

ErrPieceExpiration represents errors from the piece expiration database.

View Source
var ErrPieceInfo = errs.Class("v0pieceinfodb error")

ErrPieceInfo represents errors from the piece info database.

View Source
var ErrPieceSpaceUsed = errs.Class("piece space used error")

ErrPieceSpaceUsed represents errors from the piece spaced used database.

View Source
var ErrPricing = errs.Class("pricing error")

ErrPricing represents errors from the pricing database.

View Source
var ErrReputation = errs.Class("reputation error")

ErrReputation represents errors from the reputation database.

View Source
var ErrSatellitesDB = errs.Class("satellitesdb error")

ErrSatellitesDB represents errors from the satellites database.

Functions

func Schema added in v0.30.4

func Schema() map[string]*dbschema.Schema

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
	Filestore filestore.Config
}

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 New

func New(log *zap.Logger, config Config) (*DB, error)

New creates a new master database for storage node

func (*DB) Bandwidth

func (db *DB) Bandwidth() bandwidth.DB

Bandwidth returns the instance of the Bandwidth database.

func (*DB) Close

func (db *DB) Close() error

Close closes any resources.

func (*DB) HeldAmount added in v0.35.2

func (db *DB) HeldAmount() heldamount.DB

HeldAmount returns instance of the HeldAmount database.

func (*DB) MigrateToLatest added in v1.4.1

func (db *DB) MigrateToLatest(ctx context.Context) error

MigrateToLatest creates any necessary tables.

func (*DB) Migration added in v0.19.0

func (db *DB) Migration(ctx context.Context) *migrate.Migration

Migration returns table migrations.

func (*DB) Notifications added in v0.28.0

func (db *DB) Notifications() notifications.DB

Notifications returns the instance of the Notifications database.

func (*DB) Orders

func (db *DB) Orders() orders.DB

Orders returns the instance of the Orders 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) Pieces

func (db *DB) Pieces() storage.Blobs

Pieces returns blob storage for pieces

func (*DB) Preflight added in v0.30.4

func (db *DB) Preflight(ctx context.Context) (err error)

Preflight conducts a pre-flight check to ensure correct schemas and minimal read+write functionality of the database tables.

func (*DB) Pricing added in v1.3.2

func (db *DB) Pricing() pricing.DB

Pricing returns instance of the Pricing 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) 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

type DBContainer interface {
	Configure(sqlDB tagsql.DB)
	GetDB() tagsql.DB
}

DBContainer defines an interface to allow accessing and setting a SQLDB

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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