Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadgerDB ¶
type BadgerDB struct {
// contains filtered or unexported fields
}
BadgerDB is a basic threadsafe key-value store.
func NewBadgerDB ¶
NewBadgerDB creates a new BadgerDB. It takes a path, like path/to/db, where the database will be stored.
func (*BadgerDB) BeginTransaction ¶
func (d *BadgerDB) BeginTransaction() kv.Transaction
BeginTransaction creates a new transaction.
type Options ¶
type Options struct { // GuaranteeFSync guarantees that all writes to the wal are fsynced before // attempting to be written to the LSM tree. GuaranteeFSync bool // GarbageCollectionInterval is the interval at which the garbage collector // runs. GarbageCollectionInterval time.Duration // Logger is the logger to use for the database. Logger log.Logger // GarbageCollectionDiscardRatio is the ratio at which the garbage collector discards // old versions of a value. It must be between 0 and 1. // Lower values will have a higher performance hit, but will use less disk space. GarbageCollectionDiscardRatio float64 }
Options are options for the BadgerDB. These get translated into Badger's options. We provide this abstraction layer since Badger has a lot of options, and I don't want future users of this to worry about all of them.
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
a Transaction is a basic wrapper around a badger to handle commits and rollbacks
func (*Transaction) Commit ¶
func (t *Transaction) Commit() error
func (*Transaction) Delete ¶
func (t *Transaction) Delete(key []byte) error
func (*Transaction) Discard ¶
func (t *Transaction) Discard()
func (*Transaction) Set ¶
func (t *Transaction) Set(key, val []byte) error
Click to show internal directories.
Click to hide internal directories.