manager

package
v1.2.16 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: BSD-3-Clause Imports: 13 Imported by: 9

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 prometheus 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 prometheus.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 prometheus.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