factory

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: 10 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AvailableDatabases added in v1.2.14

func AvailableDatabases() []string

AvailableDatabases returns the list of available database types

func New

func New(
	name string,
	dbPath string,
	readOnly bool,
	config []byte,
	gatherer interface{},
	logger log.Logger,
	metricsPrefix string,
	meterDBRegName string,
) (database.Database, error)

New creates a new database with the provided configuration

func NewFromConfig added in v1.0.3

func NewFromConfig(cfg DatabaseConfig) (database.Database, error)

NewFromConfig creates a new database from a DatabaseConfig

func RegisterDatabase added in v1.2.14

func RegisterDatabase(name string, factory DatabaseFactory)

RegisterDatabase registers a database factory for a given name

Types

type DatabaseConfig added in v1.0.3

type DatabaseConfig struct {
	Type           string
	Dir            string
	Name           string
	ReadOnly       bool
	Config         []byte
	MetricsReg     prometheus.Registerer
	Logger         log.Logger
	MetricsPrefix  string
	MeterDBRegName string
}

DatabaseConfig is a convenience struct for database configuration

type DatabaseFactory added in v1.2.14

type DatabaseFactory func(
	dbPath string,
	config []byte,
	logger log.Logger,
	registerer prometheus.Registerer,
	metricsPrefix string,
	readOnly bool,
) (database.Database, error)

DatabaseFactory is a function that creates a database

Jump to

Keyboard shortcuts

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