layer

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2018 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Overview

Package layer wraps badger kv store for adding utilities.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrValueLogSize is returned when opt.ValueLogFileSize option is not within the valid
	// range.
	ErrValueLogSize = badger.ErrValueLogSize

	// ErrValueThreshold is returned when ValueThreshold is set to a value close to or greater than
	// uint16.
	ErrValueThreshold = badger.ErrValueThreshold

	// ErrKeyNotFound is returned when key isn't found on a txn.Get.
	ErrKeyNotFound = badger.ErrKeyNotFound

	// ErrTxnTooBig is returned if too many writes are fit into a single transaction.
	ErrTxnTooBig = badger.ErrTxnTooBig

	// ErrConflict is returned when a transaction conflicts with another transaction. This can happen if
	// the read rows had been updated concurrently by another transaction.
	ErrConflict = badger.ErrConflict

	// ErrReadOnlyTxn is returned if an update function is called on a read-only transaction.
	ErrReadOnlyTxn = badger.ErrReadOnlyTxn

	// ErrDiscardedTxn is returned if a previously discarded transaction is re-used.
	ErrDiscardedTxn = badger.ErrDiscardedTxn

	// ErrEmptyKey is returned if an empty key is passed on an update function.
	ErrEmptyKey = badger.ErrEmptyKey

	// ErrRetry is returned when a log file containing the value is not found.
	// This usually indicates that it may have been garbage collected, and the
	// operation needs to be retried.
	ErrRetry = badger.ErrRetry

	// ErrThresholdZero is returned if threshold is set to zero, and value log GC is called.
	// In such a case, GC can't be run.
	ErrThresholdZero = badger.ErrThresholdZero

	// ErrNoRewrite is returned if a call for value log GC doesn't result in a log file rewrite.
	ErrNoRewrite = badger.ErrNoRewrite

	// ErrRejected is returned if a value log GC is called either while another GC is running, or
	// after DB::Close has been called.
	ErrRejected = badger.ErrRejected

	// ErrInvalidRequest is returned if the user request is invalid.
	ErrInvalidRequest = badger.ErrInvalidRequest

	// ErrManagedTxn is returned if the user tries to use an API which isn't
	// allowed due to external management of transactions, when using ManagedDB.
	ErrManagedTxn = badger.ErrManagedTxn

	// ErrInvalidDump if a data dump made previously cannot be loaded into the database.
	ErrInvalidDump = badger.ErrInvalidDump

	// ErrZeroBandwidth is returned if the user passes in zero bandwidth for sequence.
	ErrZeroBandwidth = badger.ErrZeroBandwidth

	// ErrInvalidLoadingMode is returned when opt.ValueLogLoadingMode option is not
	// within the valid range
	ErrInvalidLoadingMode = badger.ErrInvalidLoadingMode

	// ErrReplayNeeded is returned when opt.ReadOnly is set but the
	// database requires a value log replay.
	ErrReplayNeeded = badger.ErrReplayNeeded

	// ErrWindowsNotSupported is returned when opt.ReadOnly is used on Windows
	ErrWindowsNotSupported = badger.ErrWindowsNotSupported

	// ErrTruncateNeeded is returned when the value log gets corrupt, and requires truncation of
	// corrupt data to allow Badger to run properly.
	ErrTruncateNeeded = badger.ErrTruncateNeeded
)
View Source
var (
	// DefaultOptions .
	DefaultOptions = badger.DefaultOptions

	// DefaultIteratorOptions .
	DefaultIteratorOptions = badger.DefaultIteratorOptions
)

Functions

This section is empty.

Types

type BeforeCommit

type BeforeCommit func(*Txn, map[string][]byte) error

BeforeCommit .

type DB

type DB struct {
	*badger.DB
}

DB .

func Open

func Open(opt Options) (db *DB, err error)

Open .

func (*DB) Backup

func (db *DB) Backup(w io.Writer, since uint64) (uint64, error)

Backup .

func (*DB) Close

func (db *DB) Close() (err error)

Close .

func (*DB) GetMergeOperator

func (db *DB) GetMergeOperator(key []byte, f MergeFunc, dur time.Duration) *badger.MergeOperator

GetMergeOperator .

func (*DB) GetSequence

func (db *DB) GetSequence(key []byte, bandwidth uint64) (*badger.Sequence, error)

GetSequence .

func (*DB) Load

func (db *DB) Load(r io.Reader) error

Load .

func (*DB) NewTransaction

func (db *DB) NewTransaction(update bool) *Txn

NewTransaction .

func (*DB) RunValueLogGC

func (db *DB) RunValueLogGC(discardRatio float64) error

RunValueLogGC .

func (*DB) Size

func (db *DB) Size() (lsm int64, vlog int64)

Size .

func (*DB) Tables

func (db *DB) Tables() []badger.TableInfo

Tables .

func (*DB) Update

func (db *DB) Update(fn func(txn *Txn) error) error

Update .

func (*DB) UpdateWith

func (db *DB) UpdateWith(fn func(txn *Txn) error, beforeCommit BeforeCommit) error

UpdateWith .

func (*DB) View

func (db *DB) View(fn func(txn *Txn) error) error

View .

type Entry

type Entry = badger.Entry

Entry .

type Item

type Item = badger.Item

Item .

type IteratorOptions

type IteratorOptions = badger.IteratorOptions

IteratorOptions .

type ManagedDB

type ManagedDB struct {
	*badger.ManagedDB
}

ManagedDB .

func OpenManaged

func OpenManaged(opts Options) (db *ManagedDB, err error)

OpenManaged .

func (*ManagedDB) GetSequence

func (db *ManagedDB) GetSequence(_ []byte, _ uint64) (*badger.Sequence, error)

GetSequence .

func (*ManagedDB) NewTransaction

func (db *ManagedDB) NewTransaction(update bool)

NewTransaction .

func (*ManagedDB) NewTransactionAt

func (db *ManagedDB) NewTransactionAt(readTs uint64, update bool) *Txn

NewTransactionAt .

type MergeFunc

type MergeFunc = badger.MergeFunc

MergeFunc .

type Options

type Options = badger.Options

Options .

type Txn

type Txn struct {
	*badger.Txn
	// contains filtered or unexported fields
}

Txn .

func (*Txn) Commit

func (txn *Txn) Commit(callback func(error)) error

Commit .

func (*Txn) CommitAt

func (txn *Txn) CommitAt(commitTs uint64, callback func(error)) error

CommitAt .

func (*Txn) CommitAtWith

func (txn *Txn) CommitAtWith(commitTs uint64, beforeCommit BeforeCommit, callback func(error)) error

CommitAtWith .

func (*Txn) CommitWith

func (txn *Txn) CommitWith(beforeCommit BeforeCommit, callback func(error)) error

CommitWith .

func (*Txn) Delete

func (txn *Txn) Delete(key []byte) error

Delete .

func (*Txn) Discard

func (txn *Txn) Discard()

Discard .

func (*Txn) Get

func (txn *Txn) Get(key []byte) (item *badger.Item, rerr error)

Get .

func (*Txn) NewIterator

func (txn *Txn) NewIterator(opt IteratorOptions) *badger.Iterator

NewIterator .

func (*Txn) Set

func (txn *Txn) Set(key, val []byte) error

Set .

func (*Txn) SetEntry

func (txn *Txn) SetEntry(e *Entry) error

SetEntry .

func (*Txn) SetWithDiscard

func (txn *Txn) SetWithDiscard(key, val []byte, meta byte) error

SetWithDiscard .

func (*Txn) SetWithMeta

func (txn *Txn) SetWithMeta(key, val []byte, meta byte) error

SetWithMeta .

func (*Txn) SetWithTTL

func (txn *Txn) SetWithTTL(key, val []byte, dur time.Duration) error

SetWithTTL .

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL