Documentation ¶
Index ¶
- Constants
- Variables
- func CreateDB(path string, raft bool) *badger.DB
- func DeleteCF(engine *badger.DB, cf string, key []byte) error
- func DeleteRange(db *badger.DB, startKey, endKey []byte) error
- func ExceedEndKey(current, endKey []byte) bool
- func GetCF(db *badger.DB, cf string, key []byte) (val []byte, err error)
- func GetCFFromTxn(txn *badger.Txn, cf string, key []byte) (val []byte, err error)
- func GetMeta(engine *badger.DB, key []byte, msg proto.Message) error
- func GetMetaFromTxn(txn *badger.Txn, key []byte, msg proto.Message) error
- func KeyWithCF(cf string, key []byte) []byte
- func PutCF(engine *badger.DB, cf string, key []byte, val []byte) error
- func PutMeta(engine *badger.DB, key []byte, msg proto.Message) error
- type BadgerIterator
- type CFItem
- func (i *CFItem) EstimatedSize() int64
- func (i *CFItem) IsDeleted() bool
- func (i *CFItem) IsEmpty() bool
- func (i *CFItem) Key() []byte
- func (i *CFItem) KeyCopy(dst []byte) []byte
- func (i *CFItem) String() string
- func (i *CFItem) UserMeta() []byte
- func (i *CFItem) Value() ([]byte, error)
- func (i *CFItem) ValueCopy(dst []byte) ([]byte, error)
- func (i *CFItem) ValueSize() int
- func (i *CFItem) Version() uint64
- type DBItem
- type DBIterator
- type Engines
- type WriteBatch
- func (wb *WriteBatch) DeleteCF(cf string, key []byte)
- func (wb *WriteBatch) DeleteMeta(key []byte)
- func (wb *WriteBatch) Len() int
- func (wb *WriteBatch) MustWriteToDB(db *badger.DB)
- func (wb *WriteBatch) Reset()
- func (wb *WriteBatch) RollbackToSafePoint()
- func (wb *WriteBatch) SetCF(cf string, key, val []byte)
- func (wb *WriteBatch) SetMeta(key []byte, msg proto.Message) error
- func (wb *WriteBatch) SetSafePoint()
- func (wb *WriteBatch) WriteToDB(db *badger.DB) error
Constants ¶
View Source
const ( CfDefault string = "default" CfWrite string = "write" CfLock string = "lock" )
Variables ¶
Functions ¶
func ExceedEndKey ¶
func GetCFFromTxn ¶
Types ¶
type BadgerIterator ¶
type BadgerIterator struct {
// contains filtered or unexported fields
}
func NewCFIterator ¶
func NewCFIterator(cf string, txn *badger.Txn) *BadgerIterator
func (*BadgerIterator) Close ¶
func (it *BadgerIterator) Close()
func (*BadgerIterator) Item ¶
func (it *BadgerIterator) Item() DBItem
func (*BadgerIterator) Next ¶
func (it *BadgerIterator) Next()
func (*BadgerIterator) Rewind ¶
func (it *BadgerIterator) Rewind()
func (*BadgerIterator) Seek ¶
func (it *BadgerIterator) Seek(key []byte)
func (*BadgerIterator) Valid ¶
func (it *BadgerIterator) Valid() bool
func (*BadgerIterator) ValidForPrefix ¶
func (it *BadgerIterator) ValidForPrefix(prefix []byte) bool
type CFItem ¶
type CFItem struct {
// contains filtered or unexported fields
}
func (*CFItem) EstimatedSize ¶
type DBItem ¶
type DBItem interface { // Key returns the key. Key() []byte // KeyCopy returns a copy of the key of the item, writing it to dst slice. // If nil is passed, or capacity of dst isn't sufficient, a new slice would be allocated and // returned. KeyCopy(dst []byte) []byte // Value retrieves the value of the item. Value() ([]byte, error) // ValueSize returns the size of the value. ValueSize() int // ValueCopy returns a copy of the value of the item from the value log, writing it to dst slice. // If nil is passed, or capacity of dst isn't sufficient, a new slice would be allocated and // returned. ValueCopy(dst []byte) ([]byte, error) }
type DBIterator ¶
type DBIterator interface { // Item returns pointer to the current key-value pair. Item() DBItem // Valid returns false when iteration is done. Valid() bool // Next would advance the iterator by one. Always check it.Valid() after a Next() // to ensure you have access to a valid it.Item(). Next() // Seek would seek to the provided key if present. If absent, it would seek to the next smallest key // greater than provided. Seek([]byte) // Close the iterator Close() }
type Engines ¶
type Engines struct { // Data, including data which is committed (i.e., committed across other nodes) and un-committed (i.e., only present // locally). Kv *badger.DB KvPath string // Metadata used by Raft. Raft *badger.DB RaftPath string }
Engines keeps references to and data for the engines used by unistore. All engines are badger key/value databases. the Path fields are the filesystem path to where the data is stored.
func NewEngines ¶
func (*Engines) WriteKV ¶
func (en *Engines) WriteKV(wb *WriteBatch) error
func (*Engines) WriteRaft ¶
func (en *Engines) WriteRaft(wb *WriteBatch) error
type WriteBatch ¶
type WriteBatch struct {
// contains filtered or unexported fields
}
func (*WriteBatch) DeleteCF ¶
func (wb *WriteBatch) DeleteCF(cf string, key []byte)
func (*WriteBatch) DeleteMeta ¶
func (wb *WriteBatch) DeleteMeta(key []byte)
func (*WriteBatch) Len ¶
func (wb *WriteBatch) Len() int
func (*WriteBatch) MustWriteToDB ¶
func (wb *WriteBatch) MustWriteToDB(db *badger.DB)
func (*WriteBatch) Reset ¶
func (wb *WriteBatch) Reset()
func (*WriteBatch) RollbackToSafePoint ¶
func (wb *WriteBatch) RollbackToSafePoint()
func (*WriteBatch) SetCF ¶
func (wb *WriteBatch) SetCF(cf string, key, val []byte)
func (*WriteBatch) SetSafePoint ¶
func (wb *WriteBatch) SetSafePoint()
Click to show internal directories.
Click to hide internal directories.