Documentation ¶
Index ¶
- Variables
- func NewBadgerTMDB(dir string) (tmdb.DB, error)
- type BadgerStore
- type Tx
- func (t *Tx) CanFinish() bool
- func (t *Tx) Commit() error
- func (t *Tx) Del(key []byte) error
- func (t *Tx) Discard()
- func (t *Tx) Get(key []byte) (*common.Record, error)
- func (t *Tx) GetTx() *badger.Txn
- func (t *Tx) Iterate(prefix []byte, first bool, iterFunc func(rec *common.Record) bool)
- func (t *Tx) NewBatch() interface{}
- func (t *Tx) NewTx(autoFinish, renew bool) types.Tx
- func (t *Tx) Put(record *common.Record) error
- func (t *Tx) RawIterator(opts interface{}) interface{}
- func (t *Tx) RenewTx()
Constants ¶
This section is empty.
Variables ¶
var ErrRecordNotFound = fmt.Errorf("record not found")
ErrRecordNotFound indicates that a record was not found
Functions ¶
Types ¶
type BadgerStore ¶
type BadgerStore struct { *Tx // contains filtered or unexported fields }
BadgerStore implements storagetypes.Engine. It provides storage functions built on top of badger.
func NewBadger ¶
func NewBadger(dir string) (*BadgerStore, error)
NewBadger creates an instance of BadgerStore.
func (*BadgerStore) Close ¶
func (b *BadgerStore) Close() error
Close closes the database engine and frees resources
func (*BadgerStore) Closed ¶
func (b *BadgerStore) Closed() bool
Closed checks whether the DB has been closed
func (*BadgerStore) NewTx ¶
func (b *BadgerStore) NewTx(autoFinish, renew bool) types.Tx
NewTx creates a new transaction.
autoFinish: ensure that the underlying transaction is committed after each successful operation.
renew: re-initializes the transaction after each operation. Requires autoFinish to be enabled.
type Tx ¶
Tx implements types.Tx
func (*Tx) CanFinish ¶
CanFinish checks whether transaction is automatically committed after every successful operation.
func (*Tx) Iterate ¶
Iterate finds a set of records by prefix and passes them to iterFunc for further processing.
If iterFunc returns true, the iterator is stopped and immediately released.
If first is set to true, it begins from the first record, otherwise, it will begin from the last record
func (*Tx) NewTx ¶
NewTx creates a new transaction. autoFinish: ensure that the underlying transaction is committed after each successful operation. renew: reinitialize the transaction after each operation. Requires autoFinish to be enabled.
func (*Tx) Put ¶
Put adds a record to the database. It will discard the transaction if an error occurred.
func (*Tx) RawIterator ¶
func (t *Tx) RawIterator(opts interface{}) interface{}
RawIterator returns badger's Iterator