badgerdb

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: 12 Imported by: 12

Documentation

Index

Constants

View Source
const Name = "badgerdb"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.2.2

type Config struct {
	SyncWrites           bool    `json:"syncWrites"`
	NumCompactors        int     `json:"numCompactors"`
	NumMemtables         int     `json:"numMemtables"`
	MemTableSize         int64   `json:"memTableSize"`
	ValueLogFileSize     int64   `json:"valueLogFileSize"`
	ValueLogMaxEntries   uint32  `json:"valueLogMaxEntries"`
	BlockCacheSize       int64   `json:"blockCacheSize"`
	IndexCacheSize       int64   `json:"indexCacheSize"`
	BloomFalsePositive   float64 `json:"bloomFalsePositive"`
	ValueThreshold       int     `json:"valueThreshold"`
	Compression          string  `json:"compression"`
	ZSTDCompressionLevel int     `json:"zstdCompressionLevel"`
}

Config represents BadgerDB configuration

type Database

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

Database is a badgerdb backed database

func New

func New(file string, configBytes []byte, namespace string, metrics prometheus.Registerer) (*Database, error)

New returns a new badgerdb-backed database

func (*Database) Close

func (d *Database) Close() error

Close implements the Database interface

func (*Database) Compact

func (d *Database) Compact(start []byte, limit []byte) error

Compact implements the Database interface

func (*Database) Delete

func (d *Database) Delete(key []byte) error

Delete implements the Database interface

func (*Database) Empty

func (d *Database) Empty() (bool, error)

Empty returns true if the database doesn't contain any keys (but not deleted keys)

func (*Database) Get

func (d *Database) Get(key []byte) ([]byte, error)

Get implements the Database interface

func (*Database) GetSnapshot

func (d *Database) GetSnapshot() (database.Database, error)

GetSnapshot implements the database.Database interface

func (*Database) Has

func (d *Database) Has(key []byte) (bool, error)

Has implements the Database interface

func (*Database) HealthCheck

func (d *Database) HealthCheck(ctx context.Context) (interface{}, error)

HealthCheck returns nil if the database is healthy, non-nil otherwise.

func (*Database) Len

func (d *Database) Len() (int, error)

Len returns the number of keys in the database

func (*Database) NewBatch

func (d *Database) NewBatch() database.Batch

NewBatch implements the Database interface

func (*Database) NewIterator

func (d *Database) NewIterator() database.Iterator

NewIterator implements the Database interface

func (*Database) NewIteratorWithPrefix

func (d *Database) NewIteratorWithPrefix(prefix []byte) database.Iterator

NewIteratorWithPrefix implements the Database interface

func (*Database) NewIteratorWithStart

func (d *Database) NewIteratorWithStart(start []byte) database.Iterator

NewIteratorWithStart implements the Database interface

func (*Database) NewIteratorWithStartAndPrefix

func (d *Database) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator

NewIteratorWithStartAndPrefix implements the Database interface

func (*Database) Put

func (d *Database) Put(key []byte, value []byte) error

Put implements the Database interface

Jump to

Keyboard shortcuts

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