Documentation ¶
Index ¶
- Variables
- func DatabaseCleanupCaller(handler interface{}, params ...interface{})
- func DatabaseExists(dbPath string) (bool, error)
- func NewPebbleDB(directory string, reportCompactionRunning func(running bool), ...) (*pebbleDB.DB, error)
- func NewRocksDB(path string) (*rocksdb.RocksDB, error)
- func StoreWithDefaultSettings(path string, createDatabaseIfNotExists bool, dbEngine ...Engine) (kvstore.KVStore, error)
- type Database
- func (db *Database) CompactionRunning() bool
- func (db *Database) CompactionSupported() bool
- func (db *Database) Engine() Engine
- func (db *Database) Events() *Events
- func (db *Database) KVStore() kvstore.KVStore
- func (db *Database) Metrics() *metrics.DatabaseMetrics
- func (db *Database) Size() (int64, error)
- type DatabaseCleanup
- type Engine
- func CheckDatabaseEngine(dbPath string, createDatabaseIfNotExists bool, dbEngine ...Engine) (Engine, error)
- func DatabaseEngineAllowed(dbEngine Engine, allowedEngines ...Engine) (Engine, error)
- func DatabaseEngineFromString(engineStr string) (Engine, error)
- func DatabaseEngineFromStringAllowed(dbEngineStr string, allowedEngines ...Engine) (Engine, error)
- func LoadDatabaseEngineFromFile(path string) (Engine, error)
- type Events
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNothingToCleanUp is returned when nothing is there to clean up in the database. ErrNothingToCleanUp = errors.New("Nothing to clean up in the databases") )
Functions ¶
func DatabaseCleanupCaller ¶
func DatabaseCleanupCaller(handler interface{}, params ...interface{})
func DatabaseExists ¶
DatabaseExists checks if the database folder exists and is not empty.
func NewPebbleDB ¶
func NewPebbleDB(directory string, reportCompactionRunning func(running bool), enableFilter bool) (*pebbleDB.DB, error)
NewPebbleDB creates a new pebble DB instance.
func NewRocksDB ¶
NewRocksDB creates a new RocksDB instance.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database holds the underlying KVStore and database specific functions.
func New ¶
func New(databaseDirectory string, kvStore kvstore.KVStore, engine Engine, metrics *metrics.DatabaseMetrics, events *Events, compactionSupported bool, compactionRunningFunc func() bool) *Database
New creates a new Database instance.
func (*Database) CompactionRunning ¶
CompactionRunning returns whether a compaction is running.
func (*Database) CompactionSupported ¶
CompactionSupported returns whether the database engine supports compaction.
func (*Database) Metrics ¶
func (db *Database) Metrics() *metrics.DatabaseMetrics
Metrics returns the database metrics.
type DatabaseCleanup ¶
func (*DatabaseCleanup) MarshalJSON ¶
func (c *DatabaseCleanup) MarshalJSON() ([]byte, error)
type Engine ¶
type Engine string
func CheckDatabaseEngine ¶
func CheckDatabaseEngine(dbPath string, createDatabaseIfNotExists bool, dbEngine ...Engine) (Engine, error)
CheckDatabaseEngine checks if the correct database engine is used. This function stores a so called "database info file" in the database folder or checks if an existing "database info file" contains the correct engine. Otherwise the files in the database folder are not compatible.
func DatabaseEngineAllowed ¶
DatabaseEngineAllowed checks if the database engine is allowed.
func DatabaseEngineFromString ¶
DatabaseEngineFromString parses an engine from a string. Returns an error if the engine is unknown.
func DatabaseEngineFromStringAllowed ¶
DatabaseEngineFromStringAllowed parses an engine from a string and checks if the database engine is allowed.
func LoadDatabaseEngineFromFile ¶
LoadDatabaseEngineFromFile returns the engine from the "database info file".