kv

package
v0.6.0-jatov2-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// EntryNotFoundError is an error for a storage entry not found
	EntryNotFoundError = "EntryNotFoundError"
)

Variables

This section is empty.

Functions

func New

func New(logger *zap.Logger, options basedb.Options) (basedb.IDb, error)

New create new instance of Badger db

Types

type BadgerDb

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

BadgerDb struct

func (*BadgerDb) Badger added in v0.4.7

func (b *BadgerDb) Badger() *badger.DB

Badger returns the underlying badger.DB

func (*BadgerDb) Close

func (b *BadgerDb) Close(logger *zap.Logger) error

Close closes the database.

func (*BadgerDb) CountByCollection added in v0.0.4

func (b *BadgerDb) CountByCollection(prefix []byte) (int64, error)

CountByCollection return the object count for all keys under specified prefix(bucket)

func (*BadgerDb) Delete added in v0.1.4

func (b *BadgerDb) Delete(prefix []byte, key []byte) error

Delete key in specific prefix

func (*BadgerDb) DeleteByPrefix added in v0.3.2

func (b *BadgerDb) DeleteByPrefix(prefix []byte) (int, error)

DeleteByPrefix all items with this prefix

func (*BadgerDb) FullGC added in v0.4.7

func (b *BadgerDb) FullGC(ctx context.Context) error

FullGC runs a long garbage collection cycle to reclaim (ideally) all unused disk space. Designed to be called when the database is not being used.

func (*BadgerDb) Get

func (b *BadgerDb) Get(prefix []byte, key []byte) (basedb.Obj, bool, error)

Get return value for specified key

func (*BadgerDb) GetAll added in v0.1.9

func (b *BadgerDb) GetAll(logger *zap.Logger, prefix []byte, handler func(int, basedb.Obj) error) error

GetAll returns all the items of a given collection

func (*BadgerDb) GetMany added in v0.1.8

func (b *BadgerDb) GetMany(logger *zap.Logger, prefix []byte, keys [][]byte, iterator func(basedb.Obj) error) error

GetMany return values for the given keys

func (*BadgerDb) QuickGC added in v0.4.7

func (b *BadgerDb) QuickGC(ctx context.Context) error

QuickGC runs a short garbage collection cycle to reclaim some unused disk space. Designed to be called periodically while the database is being used.

func (*BadgerDb) RemoveAllByCollection added in v0.0.18

func (b *BadgerDb) RemoveAllByCollection(prefix []byte) error

RemoveAllByCollection cleans all items in a collection

func (*BadgerDb) Set

func (b *BadgerDb) Set(prefix []byte, key []byte, value []byte) error

Set save value with key to storage

func (*BadgerDb) SetMany added in v0.1.8

func (b *BadgerDb) SetMany(prefix []byte, n int, next func(int) (basedb.Obj, error)) error

SetMany save many values with the given keys in a single badger transaction

func (*BadgerDb) Update added in v0.1.11

func (b *BadgerDb) Update(fn func(basedb.Txn) error) error

Update is a gateway to badger db Update function creating and managing a read-write transaction

Jump to

Keyboard shortcuts

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