Versions in this module Expand all Collapse all v2 v2.0.1 Nov 22, 2019 Changes in this version + const FILE_ATTRIBUTE_TEMPORARY — windows/amd64 + const FILE_FLAG_DELETE_ON_CLOSE — windows/amd64 + const KeyRegistryFileName + const KeyRegistryRewriteFileName + const ManifestFilename + const ValueThresholdLimit + var DefaultIteratorOptions = IteratorOptions + var ErrBlockedWrites = errors.New("Writes are blocked, possibly due to DropAll or Close") + 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 ErrEncryptionKeyMismatch = errors.New("Encryption key mismatch") + var ErrInvalidDataKeyID = errors.New("Invalid datakey id") + var ErrInvalidDump = errors.New("Data dump cannot be read") + var ErrInvalidEncryptionKey = errors.New(...) + var ErrInvalidKey = errors.New("Key is using a reserved !badger! prefix") + var ErrInvalidLoadingMode = errors.New("Invalid ValueLogLoadingMode, must be FileIO or MemoryMap") + var ErrInvalidRequest = errors.New("Invalid request") + var ErrKeyNotFound = errors.New("Key not found") + var ErrManagedTxn = errors.New("Invalid API request. Not allowed to perform this action using ManagedDB") + var ErrNilCallback = errors.New("Callback cannot be nil") + var ErrNoPrefixes = errors.New("At least one key prefix is required") + var ErrNoRewrite = errors.New("Value log GC attempt didn't result in any cleanup") + var ErrReadOnlyTxn = errors.New("No sets or deletes are allowed in a read-only transaction") + var ErrRejected = errors.New("Value log GC request rejected") + var ErrReplayNeeded = errors.New("Database was not properly closed, cannot open read-only") + 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 ErrTruncateNeeded = errors.New("Value log truncate required to run DB. This might result in data loss") + var ErrTxnTooBig = errors.New("Txn is too big to fit into one request") + var ErrUnsortedKey = errors.New("Keys not in sorted order") + var ErrValueLogSize = errors.New("Invalid ValueLogFileSize, must be between 1MB and 2GB") + var ErrWindowsNotSupported = errors.New("Read-only mode is not supported on Windows") + var ErrZeroBandwidth = errors.New("Bandwidth must be greater than zero") + func WriteKeyRegistry(reg *KeyRegistry, opt KeyRegistryOptions) error + type DB struct + func Open(opt Options) (db *DB, err error) + func OpenManaged(opts Options) (*DB, error) + func (db *DB) Backup(w io.Writer, since uint64) (uint64, error) + func (db *DB) CacheMetrics() *ristretto.Metrics + func (db *DB) Close() error + func (db *DB) DropAll() error + func (db *DB) DropPrefix(prefix []byte) error + func (db *DB) Flatten(workers int) error + func (db *DB) GetMergeOperator(key []byte, f MergeFunc, dur time.Duration) *MergeOperator + func (db *DB) GetSequence(key []byte, bandwidth uint64) (*Sequence, error) + func (db *DB) KeySplits(prefix []byte) []string + func (db *DB) Load(r io.Reader, maxPendingWrites int) error + func (db *DB) MaxBatchCount() int64 + func (db *DB) MaxBatchSize() int64 + func (db *DB) NewKVLoader(maxPendingWrites int) *KVLoader + func (db *DB) NewStream() *Stream + func (db *DB) NewStreamAt(readTs uint64) *Stream + func (db *DB) NewStreamWriter() *StreamWriter + func (db *DB) NewTransaction(update bool) *Txn + func (db *DB) NewTransactionAt(readTs uint64, update bool) *Txn + func (db *DB) NewWriteBatch() *WriteBatch + func (db *DB) NewWriteBatchAt(commitTs uint64) *WriteBatch + func (db *DB) PrintHistogram(keyPrefix []byte) + func (db *DB) RunValueLogGC(discardRatio float64) error + func (db *DB) SetDiscardTs(ts uint64) + func (db *DB) Size() (lsm, vlog int64) + func (db *DB) Subscribe(ctx context.Context, cb func(kv *KVList), prefixes ...[]byte) error + func (db *DB) Sync() error + func (db *DB) Tables(withKeysCount bool) []TableInfo + func (db *DB) Update(fn func(txn *Txn) error) error + func (db *DB) VerifyChecksum() error + func (db *DB) View(fn func(txn *Txn) error) error + type Entry struct + ExpiresAt uint64 + Key []byte + UserMeta byte + Value []byte + func NewEntry(key, value []byte) *Entry + func (e *Entry) WithDiscard() *Entry + func (e *Entry) WithMeta(meta byte) *Entry + func (e *Entry) WithTTL(dur time.Duration) *Entry + type Item struct + func (item *Item) DiscardEarlierVersions() bool + func (item *Item) EstimatedSize() int64 + func (item *Item) ExpiresAt() uint64 + func (item *Item) IsDeletedOrExpired() bool + func (item *Item) Key() []byte + func (item *Item) KeyCopy(dst []byte) []byte + func (item *Item) KeySize() int64 + func (item *Item) String() string + func (item *Item) UserMeta() byte + func (item *Item) Value(fn func(val []byte) error) error + func (item *Item) ValueCopy(dst []byte) ([]byte, error) + func (item *Item) ValueSize() int64 + func (item *Item) Version() uint64 + type Iterator struct + func (it *Iterator) Close() + func (it *Iterator) Item() *Item + 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 + AllVersions bool + InternalAccess bool + PrefetchSize int + PrefetchValues bool + Prefix []byte + Reverse bool + type KVList = pb.KVList + type KVLoader struct + func (l *KVLoader) Finish() error + func (l *KVLoader) Set(kv *pb.KV) error + type KeyRegistry struct + func OpenKeyRegistry(opt KeyRegistryOptions) (*KeyRegistry, error) + func (kr *KeyRegistry) Close() error + type KeyRegistryOptions struct + Dir string + EncryptionKey []byte + EncryptionKeyRotationDuration time.Duration + ReadOnly bool + type Logger interface + Debugf func(string, ...interface{}) + Errorf func(string, ...interface{}) + Infof func(string, ...interface{}) + Warningf func(string, ...interface{}) + type Manifest struct + Creations int + Deletions int + Levels []levelManifest + Tables map[uint64]TableManifest + func ReplayManifestFile(fp *os.File) (Manifest, int64, error) + type MergeFunc func(existingVal, newVal []byte) []byte + type MergeOperator struct + func (op *MergeOperator) Add(val []byte) error + func (op *MergeOperator) Get() ([]byte, error) + func (op *MergeOperator) Stop() + type Options struct + BlockSize int + BloomFalsePositive float64 + ChecksumVerificationMode options.ChecksumVerificationMode + CompactL0OnClose bool + Compression options.CompressionType + Dir string + EncryptionKey []byte + EncryptionKeyRotationDuration time.Duration + EventLogging bool + KeepL0InMemory bool + LevelOneSize int64 + LevelSizeMultiplier int + LogRotatesToFlush int32 + Logger Logger + MaxCacheSize int64 + MaxLevels int + MaxTableSize int64 + NumCompactors int + NumLevelZeroTables int + NumLevelZeroTablesStall int + NumMemtables int + NumVersionsToKeep int + ReadOnly bool + SyncWrites bool + TableLoadingMode options.FileLoadingMode + Truncate bool + ValueDir string + ValueLogFileSize int64 + ValueLogLoadingMode options.FileLoadingMode + ValueLogMaxEntries uint32 + ValueThreshold int + VerifyValueChecksum bool + func DefaultOptions(path string) Options + func LSMOnlyOptions(path string) Options + func (opt *Options) Debugf(format string, v ...interface{}) + func (opt *Options) Errorf(format string, v ...interface{}) + func (opt *Options) Infof(format string, v ...interface{}) + func (opt *Options) Warningf(format string, v ...interface{}) + func (opt Options) WithBlockSize(val int) Options + func (opt Options) WithBloomFalsePositive(val float64) Options + func (opt Options) WithChecksumVerificationMode(cvMode options.ChecksumVerificationMode) Options + func (opt Options) WithCompactL0OnClose(val bool) Options + func (opt Options) WithCompression(cType options.CompressionType) Options + func (opt Options) WithDir(val string) Options + func (opt Options) WithEncryptionKey(key []byte) Options + func (opt Options) WithEncryptionKeyRotationDuration(d time.Duration) Options + func (opt Options) WithEventLogging(enabled bool) Options + func (opt Options) WithKeepL0InMemory(val bool) Options + func (opt Options) WithLevelOneSize(val int64) Options + func (opt Options) WithLevelSizeMultiplier(val int) Options + func (opt Options) WithLogRotatesToFlush(val int32) Options + func (opt Options) WithLogger(val Logger) Options + func (opt Options) WithMaxCacheSize(size int64) Options + func (opt Options) WithMaxLevels(val int) Options + func (opt Options) WithMaxTableSize(val int64) Options + func (opt Options) WithNumCompactors(val int) Options + func (opt Options) WithNumLevelZeroTables(val int) Options + func (opt Options) WithNumLevelZeroTablesStall(val int) Options + func (opt Options) WithNumMemtables(val int) Options + func (opt Options) WithNumVersionsToKeep(val int) Options + func (opt Options) WithReadOnly(val bool) Options + func (opt Options) WithSyncWrites(val bool) Options + func (opt Options) WithTableLoadingMode(val options.FileLoadingMode) Options + func (opt Options) WithTruncate(val bool) Options + func (opt Options) WithValueDir(val string) Options + func (opt Options) WithValueLogFileSize(val int64) Options + func (opt Options) WithValueLogLoadingMode(val options.FileLoadingMode) Options + func (opt Options) WithValueLogMaxEntries(val uint32) Options + func (opt Options) WithValueThreshold(val int) Options + func (opt Options) WithVerifyValueChecksum(val bool) Options + type Sequence struct + func (seq *Sequence) Next() (uint64, error) + func (seq *Sequence) Release() error + type Stream struct + ChooseKey func(item *Item) bool + KeyToList func(key []byte, itr *Iterator) (*pb.KVList, error) + LogPrefix string + NumGo int + Prefix []byte + Send func(*pb.KVList) error + func (st *Stream) Orchestrate(ctx context.Context) error + func (st *Stream) ToList(key []byte, itr *Iterator) (*pb.KVList, error) + func (stream *Stream) Backup(w io.Writer, since uint64) (uint64, error) + type StreamWriter struct + func (sw *StreamWriter) Flush() error + func (sw *StreamWriter) Prepare() error + func (sw *StreamWriter) Write(kvs *pb.KVList) error + type TableInfo struct + ID uint64 + KeyCount uint64 + Left []byte + Level int + Right []byte + type TableManifest struct + Compression options.CompressionType + KeyID uint64 + Level uint8 + type Txn struct + func (txn *Txn) Commit() error + func (txn *Txn) CommitAt(commitTs uint64, callback func(error)) error + func (txn *Txn) CommitWith(cb func(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) NewKeyIterator(key []byte, opt IteratorOptions) *Iterator + func (txn *Txn) ReadTs() uint64 + func (txn *Txn) Set(key, val []byte) error + func (txn *Txn) SetEntry(e *Entry) error + type WriteBatch struct + func (wb *WriteBatch) Cancel() + func (wb *WriteBatch) Delete(k []byte) error + func (wb *WriteBatch) Error() error + func (wb *WriteBatch) Flush() error + func (wb *WriteBatch) Set(k, v []byte) error + func (wb *WriteBatch) SetEntry(e *Entry) error + func (wb *WriteBatch) SetMaxPendingTxns(max int) Other modules containing this package github.com/perlin-network/badger