kv

package
v1.3.11 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: GPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadgerDB added in v1.1.0

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

BadgerDB struct

func New

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

New creates a persistent DB instance.

func NewInMemory added in v1.1.0

func NewInMemory(logger *zap.Logger, options basedb.Options) (*BadgerDB, error)

NewInMemory creates an in-memory DB instance.

func (*BadgerDB) Badger added in v1.1.0

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

Badger returns the underlying badger.DB

func (*BadgerDB) Begin added in v1.1.0

func (b *BadgerDB) Begin() basedb.Txn

Begin creates a read-write transaction.

func (*BadgerDB) BeginRead added in v1.1.0

func (b *BadgerDB) BeginRead() basedb.ReadTxn

BeginRead creates a read-only transaction.

func (*BadgerDB) Close added in v1.1.0

func (b *BadgerDB) Close() error

Close closes the database.

func (*BadgerDB) CountPrefix added in v1.1.0

func (b *BadgerDB) CountPrefix(prefix []byte) (int64, error)

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

func (*BadgerDB) Delete added in v1.1.0

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

Delete key in specific prefix

func (*BadgerDB) DropPrefix added in v1.1.0

func (b *BadgerDB) DropPrefix(prefix []byte) error

DropPrefix cleans all items in a collection

func (*BadgerDB) FullGC added in v1.1.0

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 added in v1.1.0

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

Get return value for specified key

func (*BadgerDB) GetAll added in v1.1.0

func (b *BadgerDB) GetAll(prefix []byte, handler func(int, basedb.Obj) error) error

GetAll returns all the items of a given collection

func (*BadgerDB) GetMany added in v1.1.0

func (b *BadgerDB) GetMany(prefix []byte, keys [][]byte, iterator func(basedb.Obj) error) error

GetMany return values for the given keys

func (*BadgerDB) QuickGC added in v1.1.0

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) Set added in v1.1.0

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

Set save value with key to storage

func (*BadgerDB) SetMany added in v1.1.0

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 v1.1.0

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

func (*BadgerDB) Using added in v1.1.0

Using returns the given ReadWriter, falling back to the database if it's nil.

func (*BadgerDB) UsingReader added in v1.1.0

func (b *BadgerDB) UsingReader(r basedb.Reader) basedb.Reader

UsingReader returns the given Reader, falling back to the database if it's nil.

Jump to

Keyboard shortcuts

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