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 ¶
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.
Click to show internal directories.
Click to hide internal directories.