Documentation ¶
Index ¶
- type BadgerStore
- func (s *BadgerStore) Close() error
- func (s *BadgerStore) Erase() error
- func (s *BadgerStore) NewTransaction(update bool) *BadgerStoreTxn
- func (s *BadgerStore) Purge() error
- func (s *BadgerStore) UpdateInTx(fn func(txn StoreTxn) error) error
- func (s *BadgerStore) ViewInTx(fn func(txn StoreTxn) error) error
- type BadgerStoreTxn
- func (t *BadgerStoreTxn) Commit(callback func(error)) error
- func (t *BadgerStoreTxn) Count(prefix []byte) (uint64, error)
- func (t *BadgerStoreTxn) Delete(key []byte) error
- func (t *BadgerStoreTxn) Discard()
- func (t *BadgerStoreTxn) Drop(prefix []byte) error
- func (t *BadgerStoreTxn) Get(key []byte, fn func([]byte, byte) error) error
- func (t *BadgerStoreTxn) Iterator(pre byte, fn func([]byte, []byte, byte) error) error
- func (t *BadgerStoreTxn) Set(key []byte, val []byte) error
- func (t *BadgerStoreTxn) SetWithMeta(key, val []byte, meta byte) error
- func (t *BadgerStoreTxn) Stream(prefix []byte, filter func(item *badger.Item) bool, ...) error
- func (t *BadgerStoreTxn) Upgrade(migrations []Migration) error
- type Migration
- type Migrations
- type Store
- type StoreTxn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadgerStore ¶
type BadgerStore struct {
// contains filtered or unexported fields
}
BadgerStore represents a block lattice store backed by a badger database.
func (*BadgerStore) Erase ¶
func (s *BadgerStore) Erase() error
func (*BadgerStore) NewTransaction ¶
func (s *BadgerStore) NewTransaction(update bool) *BadgerStoreTxn
func (*BadgerStore) Purge ¶
func (s *BadgerStore) Purge() error
Purge purges any old/deleted keys from the database.
func (*BadgerStore) UpdateInTx ¶
func (s *BadgerStore) UpdateInTx(fn func(txn StoreTxn) error) error
type BadgerStoreTxn ¶
type BadgerStoreTxn struct {
// contains filtered or unexported fields
}
func (*BadgerStoreTxn) Commit ¶
func (t *BadgerStoreTxn) Commit(callback func(error)) error
func (*BadgerStoreTxn) Count ¶ added in v0.0.9
func (t *BadgerStoreTxn) Count(prefix []byte) (uint64, error)
func (*BadgerStoreTxn) Delete ¶
func (t *BadgerStoreTxn) Delete(key []byte) error
func (*BadgerStoreTxn) Discard ¶
func (t *BadgerStoreTxn) Discard()
func (*BadgerStoreTxn) Drop ¶ added in v1.0.4
func (t *BadgerStoreTxn) Drop(prefix []byte) error
func (*BadgerStoreTxn) SetWithMeta ¶
func (t *BadgerStoreTxn) SetWithMeta(key, val []byte, meta byte) error
func (*BadgerStoreTxn) Upgrade ¶
func (t *BadgerStoreTxn) Upgrade(migrations []Migration) error
type Migrations ¶
type Migrations []Migration
func (Migrations) Len ¶
func (m Migrations) Len() int
func (Migrations) Less ¶
func (m Migrations) Less(i, j int) bool
func (Migrations) Swap ¶
func (m Migrations) Swap(i, j int)
type Store ¶
type Store interface { io.Closer Purge() error Erase() error ViewInTx(fn func(txn StoreTxn) error) error UpdateInTx(fn func(txn StoreTxn) error) error NewTransaction(update bool) *BadgerStoreTxn }
Store is an interface that all stores need to implement.
func NewBadgerStore ¶
NewBadgerStore initializes/opens a badger database in the given directory.
type StoreTxn ¶
type StoreTxn interface { Set(key, val []byte) error SetWithMeta(key, val []byte, meta byte) error Get(key []byte, fn func([]byte, byte) error) error Delete(key []byte) error Iterator(pre byte, fn func([]byte, []byte, byte) error) error Commit(callback func(error)) error Discard() Drop(prefix []byte) error Upgrade(migrations []Migration) error Count(prefix []byte) (uint64, error) Stream(prefix []byte, filter func(item *badger.Item) bool, callback func(list *pb.KVList) error) error }
Click to show internal directories.
Click to hide internal directories.