manager

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: BSD-3-Clause Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortDescending

func SortDescending(dbs []*VersionedDatabase)

Types

type Manager

type Manager interface {
	// Current returns the database with the current database version.
	Current() *VersionedDatabase

	// Previous returns the database prior to the current database and true if a
	// previous database exists.
	Previous() (*VersionedDatabase, bool)

	// GetDatabases returns all the managed databases in order from current to
	// the oldest version.
	GetDatabases() []*VersionedDatabase

	// Close all of the databases controlled by the manager.
	Close() error

	// NewPrefixDBManager returns a new database manager with each of its
	// databases prefixed with [prefix].
	NewPrefixDBManager(prefix []byte) Manager

	// NewNestedPrefixDBManager returns a new database manager where each of its
	// databases has the nested prefix [prefix] applied to it.
	NewNestedPrefixDBManager(prefix []byte) Manager

	// NewMeterDBManager returns a new database manager with each of its
	// databases wrapped with a meterdb instance to support metrics on database
	// performance.
	NewMeterDBManager(namespace string, registerer prometheus.Registerer) (Manager, error)

	// NewCompleteMeterDBManager wraps each database instance with a meterdb
	// instance. The namespace is concatenated with the version of the database.
	// Note: calling this more than once with the same [namespace] will cause a
	// conflict error for the [registerer].
	NewCompleteMeterDBManager(namespace string, registerer prometheus.Registerer) (Manager, error)
}

func NewLevelDB

func NewLevelDB(
	dbDirPath string,
	dbConfig []byte,
	log logging.Logger,
	currentVersion version.Version,
) (Manager, error)

NewLevelDB creates a database manager of levelDBs at [filePath] by creating a database instance from each directory with a version <= [currentVersion]. If [includePreviousVersions], opens previous database versions and includes them in the returned Manager.

func NewManagerFromDBs

func NewManagerFromDBs(dbs []*VersionedDatabase) (Manager, error)

NewManagerFromDBs

func NewMemDB

func NewMemDB(currentVersion version.Version) Manager

NewMemDB returns a database manager with a single memdb instance with [currentVersion].

func NewRocksDB

func NewRocksDB(
	dbDirPath string,
	dbConfig []byte,
	log logging.Logger,
	currentVersion version.Version,
) (Manager, error)

NewRocksDB creates a database manager of rocksDBs at [filePath] by creating a database instance from each directory with a version <= [currentVersion]. If [includePreviousVersions], opens previous database versions and includes them in the returned Manager.

type VersionedDatabase

type VersionedDatabase struct {
	Database database.Database
	Version  version.Version
}

func (*VersionedDatabase) Close

func (db *VersionedDatabase) Close() error

Close the underlying database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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