Versions in this module Expand all Collapse all v0 v0.9.0 Oct 31, 2017 Changes in this version + var ErrConflict = errors.New("Transaction Conflict. Please retry") + var ErrDiscardedTxn = errors.New("This transaction has been discarded. Create a new one") + var ErrEmptyKey = errors.New("Key cannot be empty") + var ErrInvalidDump = errors.New("Data dump cannot be read") + var ErrKeyNotFound = errors.New("Key not found") + var ErrManagedTxn = errors.New("Invalid API request. Not allowed to perform this action using ManagedDB") + var ErrReadOnlyTxn = errors.New("No sets or deletes are allowed in a read-only transaction") + var ErrTxnTooBig = errors.New("Txn is too big to fit into one request") + type DB struct + func Open(opt Options) (db *DB, err error) + func (db *DB) Backup(w io.Writer, since uint64) (uint64, error) + func (db *DB) Close() (err error) + func (db *DB) Load(r io.Reader) error + func (db *DB) NewTransaction(update bool) *Txn + func (db *DB) PurgeOlderVersions() error + func (db *DB) PurgeVersionsBelow(key []byte, ts uint64) error + func (db *DB) RunValueLogGC(discardRatio float64) error + func (db *DB) Update(fn func(txn *Txn) error) error + func (db *DB) View(fn func(txn *Txn) error) error + type Item struct + func (item *Item) EstimatedSize() int64 + func (item *Item) Key() []byte + func (item *Item) ToString() string + func (item *Item) UserMeta() byte + func (item *Item) Value() ([]byte, error) + func (item *Item) Version() uint64 type IteratorOptions + AllVersions bool + type ManagedDB struct + func OpenManaged(opts Options) (*ManagedDB, error) + func (db *ManagedDB) NewTransaction(update bool) + func (db *ManagedDB) NewTransactionAt(readTs uint64, update bool) *Txn + func (db *ManagedDB) PurgeVersionsBelow(key []byte, ts uint64) error + type Txn struct + func (txn *Txn) Commit(callback func(error)) error + func (txn *Txn) CommitAt(commitTs uint64, callback func(error)) error + func (txn *Txn) Delete(key []byte) error + func (txn *Txn) Discard() + func (txn *Txn) Get(key []byte) (item *Item, rerr error) + func (txn *Txn) NewIterator(opt IteratorOptions) *Iterator + func (txn *Txn) Set(key, val []byte, userMeta byte) error v0.8.1 Oct 30, 2017 Changes in this version + const BitDelete + const BitSetIfAbsent + const BitUnused + const BitValuePointer + const M + const ManifestFilename + var DefaultIteratorOptions = IteratorOptions + var DefaultOptions = Options + var ErrCasMismatch = errors.New("CompareAndSet failed due to counter mismatch") + var ErrInvalidDir = errors.New("Invalid Dir, directory does not exist") + var ErrInvalidRequest = errors.New("Invalid request") + var ErrKeyExists = errors.New("SetIfAbsent failed since key already exists") + var ErrNoRewrite = errors.New("Value log GC attempt didn't result in any cleanup") + var ErrRejected = errors.New("Value log GC request rejected") + var ErrRetry = errors.New("Unable to find log file. Please retry") + var ErrThresholdZero = errors.New("Value log GC can't run because threshold is set to zero") + var ErrValueLogSize = errors.New("Invalid ValueLogFileSize, must be between 1MB and 2GB") + func OpenDir(path string) (*os.File, error) + type DirectoryLockGuard struct + func AcquireDirectoryLock(dirPath string, pidFileName string) (*DirectoryLockGuard, error) + func (g *DirectoryLockGuard) Release() error + func (guard *DirectoryLockGuard) Release() error + type Entry struct + CASCounterCheck uint64 + Error error + Key []byte + Meta byte + UserMeta byte + Value []byte + func EntriesDelete(s []*Entry, key []byte) []*Entry + func EntriesSet(s []*Entry, key, val []byte) []*Entry + type Iterator struct + func (it *Iterator) Close() + func (it *Iterator) Item() *KVItem + func (it *Iterator) Next() + func (it *Iterator) Rewind() + func (it *Iterator) Seek(key []byte) + func (it *Iterator) Valid() bool + func (it *Iterator) ValidForPrefix(prefix []byte) bool + type IteratorOptions struct + PrefetchSize int + PrefetchValues bool + Reverse bool + type KV struct + func NewKV(optParam *Options) (out *KV, err error) + func (db *KV) Backup(w io.Writer) error + func (s *KV) BatchSet(entries []*Entry) error + func (s *KV) BatchSetAsync(entries []*Entry, f func(error)) + func (s *KV) Close() (err error) + func (s *KV) CompareAndDelete(key []byte, casCounter uint64) error + func (s *KV) CompareAndDeleteAsync(key []byte, casCounter uint64, f func(error)) + func (s *KV) CompareAndSet(key []byte, val []byte, casCounter uint64) error + func (s *KV) CompareAndSetAsync(key []byte, val []byte, casCounter uint64, f func(error)) + func (s *KV) Delete(key []byte) error + func (s *KV) DeleteAsync(key []byte, f func(error)) + func (s *KV) Exists(key []byte) (bool, error) + func (s *KV) Get(key []byte, item *KVItem) error + func (s *KV) NewIterator(opt IteratorOptions) *Iterator + func (s *KV) RunValueLogGC(discardRatio float64) error + func (s *KV) Set(key, val []byte, userMeta byte) error + func (s *KV) SetAsync(key, val []byte, userMeta byte, f func(error)) + func (s *KV) SetIfAbsent(key, val []byte, userMeta byte) error + func (s *KV) SetIfAbsentAsync(key, val []byte, userMeta byte, f func(error)) error + type KVItem struct + func (item *KVItem) Counter() uint64 + func (item *KVItem) EstimatedSize() int64 + func (item *KVItem) Key() []byte + func (item *KVItem) UserMeta() byte + func (item *KVItem) Value(consumer func([]byte) error) error + type LevelManifest struct + Tables map[uint64]struct{} + type Manifest struct + Creations int + Deletions int + Levels []LevelManifest + Tables map[uint64]TableManifest + func ReplayManifestFile(fp *os.File) (ret Manifest, truncOffset int64, err error) + type Options struct + Dir string + DoNotCompact bool + LevelOneSize int64 + LevelSizeMultiplier int + MaxLevels int + MaxTableSize int64 + NumCompactors int + NumLevelZeroTables int + NumLevelZeroTablesStall int + NumMemtables int + SyncWrites bool + TableLoadingMode options.FileLoadingMode + ValueDir string + ValueLogFileSize int64 + ValueThreshold int + type TableManifest struct + Level uint8 Other modules containing this package gopkg.in/dgraph-io/badger.v1 gopkg.in/dgraph-io/badger.v2