satellitedb

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2019 License: AGPL-3.0 Imports: 36 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// OverlayCacheWindow defines the time which the Node selection uses for recent seen nodes
	OverlayCacheWindow = 1 * time.Hour
)

Variables

View Source
var ErrMigrate = errs.Class("migrate")

ErrMigrate is for tracking migration errors

View Source
var (
	// Error is the default satellitedb errs class
	Error = errs.Class("satellitedb")
)

Functions

func New

func New(log *zap.Logger, databaseURL string) (satellite.DB, error)

New creates instance of database (supports: postgres, sqlite3)

func NewInMemory

func NewInMemory(log *zap.Logger) (satellite.DB, error)

NewInMemory creates instance of Sqlite in memory satellite database

Types

type ConsoleDB

type ConsoleDB struct {
	// contains filtered or unexported fields
}

ConsoleDB contains access to different satellite databases

func (*ConsoleDB) APIKeys

func (db *ConsoleDB) APIKeys() console.APIKeys

APIKeys is a getter for APIKeys repository

func (*ConsoleDB) BeginTx

func (db *ConsoleDB) BeginTx(ctx context.Context) (console.DBTx, error)

BeginTx is a method for opening transaction

func (*ConsoleDB) BucketUsage

func (db *ConsoleDB) BucketUsage() accounting.BucketUsage

BucketUsage is a getter for accounting.BucketUsage repository

func (*ConsoleDB) ProjectMembers

func (db *ConsoleDB) ProjectMembers() console.ProjectMembers

ProjectMembers is a getter for ProjectMembers repository

func (*ConsoleDB) Projects

func (db *ConsoleDB) Projects() console.Projects

Projects is a getter for Projects repository

func (*ConsoleDB) RegistrationTokens

func (db *ConsoleDB) RegistrationTokens() console.RegistrationTokens

RegistrationTokens is a getter for RegistrationTokens repository

func (*ConsoleDB) Users

func (db *ConsoleDB) Users() console.Users

Users is getter a for Users repository

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB contains access to different database tables

func (*DB) Accounting

func (db *DB) Accounting() accounting.DB

Accounting returns database for tracking bandwidth agreements over time

func (*DB) BandwidthAgreement

func (db *DB) BandwidthAgreement() bwagreement.DB

BandwidthAgreement is a getter for bandwidth agreement repository

func (*DB) CertDB

func (db *DB) CertDB() certdb.DB

CertDB is a getter for uplink's specific info like public key, id, etc...

func (*DB) Close

func (db *DB) Close() error

Close is used to close db connection

func (*DB) Console

func (db *DB) Console() console.DB

Console returns database for storing users, projects and api keys

func (*DB) CreateSchema

func (db *DB) CreateSchema(schema string) error

CreateSchema creates a schema if it doesn't exist.

func (*DB) CreateTables

func (db *DB) CreateTables() error

CreateTables is a method for creating all tables for database

func (*DB) DropSchema

func (db *DB) DropSchema(schema string) error

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) Orders

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

Orders returns database for storing orders

func (*DB) OverlayCache

func (db *DB) OverlayCache() overlay.DB

OverlayCache is a getter for overlay cache repository

func (*DB) PostgresMigration

func (db *DB) PostgresMigration() *migrate.Migration

PostgresMigration returns steps needed for migrating postgres database.

func (*DB) RepairQueue

func (db *DB) RepairQueue() queue.RepairQueue

RepairQueue is a getter for RepairQueue repository

func (*DB) TestDBAccess

func (db *DB) TestDBAccess() *dbx.DB

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

func (*DBTx) Commit

func (db *DBTx) Commit() error

Commit is a method for committing and closing transaction

func (*DBTx) Rollback

func (db *DBTx) Rollback() error

Rollback is a method for rollback and closing transaction

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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