Documentation ¶
Index ¶
- type BadgerDB
- func (b *BadgerDB) Badger() *badger.DB
- func (b *BadgerDB) Begin() basedb.Txn
- func (b *BadgerDB) BeginRead() basedb.ReadTxn
- func (b *BadgerDB) Close() error
- func (b *BadgerDB) CountPrefix(prefix []byte) (int64, error)
- func (b *BadgerDB) Delete(prefix []byte, key []byte) error
- func (b *BadgerDB) DropPrefix(prefix []byte) error
- func (b *BadgerDB) FullGC(ctx context.Context) error
- func (b *BadgerDB) Get(prefix []byte, key []byte) (basedb.Obj, bool, error)
- func (b *BadgerDB) GetAll(prefix []byte, handler func(int, basedb.Obj) error) error
- func (b *BadgerDB) GetMany(prefix []byte, keys [][]byte, iterator func(basedb.Obj) error) error
- func (b *BadgerDB) QuickGC(ctx context.Context) error
- func (b *BadgerDB) Set(prefix []byte, key []byte, value []byte) error
- func (b *BadgerDB) SetMany(prefix []byte, n int, next func(int) (basedb.Obj, error)) error
- func (b *BadgerDB) Update(fn func(basedb.Txn) error) error
- func (b *BadgerDB) Using(rw basedb.ReadWriter) basedb.ReadWriter
- func (b *BadgerDB) UsingReader(r basedb.Reader) basedb.Reader
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 NewInMemory ¶ added in v1.1.0
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) CountPrefix ¶ added in v1.1.0
CountPrefix return the object count for all keys under specified prefix(bucket)
func (*BadgerDB) DropPrefix ¶ added in v1.1.0
DropPrefix cleans all items in a collection
func (*BadgerDB) FullGC ¶ added in v1.1.0
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) QuickGC ¶ added in v1.1.0
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) SetMany ¶ added in v1.1.0
SetMany save many values with the given keys in a single badger transaction
func (*BadgerDB) Update ¶ added in v1.1.0
Update is a gateway to badger db Update function creating and managing a read-write transaction
func (*BadgerDB) Using ¶ added in v1.1.0
func (b *BadgerDB) Using(rw basedb.ReadWriter) basedb.ReadWriter
Using returns the given ReadWriter, falling back to the database if it's nil.