manager

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: BSD-3-Clause Imports: 12 Imported by: 5 modules, 2 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 AvailableTypes added in v1.2.14

func AvailableTypes() []string

AvailableTypes returns a list of available database types

func RegisterDatabaseType added in v1.2.14

func RegisterDatabaseType(name string, creator DatabaseCreator)

RegisterDatabaseType registers a database creator for a given type

Types

type Config

type Config struct {
	// Type is the database type ("badgerdb", "memdb", or optionally "leveldb", "pebbledb" if built with those tags)
	Type string

	// Path is the database path (relative to base directory)
	Path string

	// Namespace is used for metrics
	Namespace string

	// CacheSize is the size of the cache in MB
	CacheSize int

	// HandleCap is the maximum number of open file handles
	HandleCap int

	// EnableMetrics enables metrics
	EnableMetrics bool

	// EnableVersioning enables database versioning
	EnableVersioning bool

	// Prefix adds a prefix to all keys
	Prefix []byte

	// ReadOnly opens the database in read-only mode
	ReadOnly bool
}

Config defines the database configuration.

func DefaultBadgerDBConfig

func DefaultBadgerDBConfig(path string) *Config

DefaultBadgerDBConfig returns a default BadgerDB configuration.

func DefaultMemoryConfig

func DefaultMemoryConfig() *Config

DefaultMemoryConfig returns a default in-memory database configuration.

type DatabaseCreator added in v1.2.14

type DatabaseCreator func(path string, config *Config, registerer metric.Registerer) (db.Database, error)

DatabaseCreator is a function that creates a database

type Manager

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

Manager is a database manager that can create new database instances.

func NewManager

func NewManager(baseDir string, registerer metric.Registerer) *Manager

NewManager creates a new database manager.

func (*Manager) New

func (m *Manager) New(config *Config) (db.Database, error)

New creates a new database instance.

Jump to

Keyboard shortcuts

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