Documentation ¶
Index ¶
- Constants
- func Repair(cfg *config.Config) error
- type BatchData
- type BatchDataReplay
- type BatchItem
- type DB
- func (db *DB) Begin() (*Tx, error)
- func (db *DB) Close() error
- func (db *DB) Compact() error
- func (db *DB) Delete(key []byte) error
- func (db *DB) Get(key []byte) ([]byte, error)
- func (db *DB) GetSlice(key []byte) (Slice, error)
- func (db *DB) NewIterator() *Iterator
- func (db *DB) NewSnapshot() (*Snapshot, error)
- func (db *DB) NewWriteBatch() *WriteBatch
- func (db *DB) Put(key []byte, value []byte) error
- func (db *DB) RangeIterator(min []byte, max []byte, rangeType uint8) *RangeLimitIterator
- func (db *DB) RangeLimitIterator(min []byte, max []byte, rangeType uint8, offset int, count int) *RangeLimitIterator
- func (db *DB) RevRangeIterator(min []byte, max []byte, rangeType uint8) *RangeLimitIterator
- func (db *DB) RevRangeLimitIterator(min []byte, max []byte, rangeType uint8, offset int, count int) *RangeLimitIterator
- func (db *DB) Stat() *Stat
- func (db *DB) String() string
- type Iterator
- func (it *Iterator) BufKey(b []byte) []byte
- func (it *Iterator) BufValue(b []byte) []byte
- func (it *Iterator) Close()
- func (it *Iterator) Find(key []byte) []byte
- func (it *Iterator) Key() []byte
- func (it *Iterator) Next()
- func (it *Iterator) Prev()
- func (it *Iterator) RawFind(key []byte) []byte
- func (it *Iterator) RawKey() []byte
- func (it *Iterator) RawValue() []byte
- func (it *Iterator) Seek(key []byte)
- func (it *Iterator) SeekToFirst()
- func (it *Iterator) SeekToLast()
- func (it *Iterator) Valid() bool
- func (it *Iterator) Value() []byte
- type Limit
- type Range
- type RangeLimitIterator
- func (it *RangeLimitIterator) BufKey(b []byte) []byte
- func (it *RangeLimitIterator) BufValue(b []byte) []byte
- func (it *RangeLimitIterator) Close()
- func (it *RangeLimitIterator) Key() []byte
- func (it *RangeLimitIterator) Next()
- func (it *RangeLimitIterator) RawKey() []byte
- func (it *RangeLimitIterator) RawValue() []byte
- func (it *RangeLimitIterator) Valid() bool
- func (it *RangeLimitIterator) Value() []byte
- type Slice
- type Snapshot
- type Stat
- type Tx
- func (tx *Tx) Commit() error
- func (tx *Tx) Delete(key []byte) error
- func (tx *Tx) Get(key []byte) ([]byte, error)
- func (tx *Tx) GetSlice(key []byte) (Slice, error)
- func (tx *Tx) NewIterator() *Iterator
- func (tx *Tx) NewWriteBatch() *WriteBatch
- func (tx *Tx) Put(key []byte, value []byte) error
- func (tx *Tx) RangeIterator(min []byte, max []byte, rangeType uint8) *RangeLimitIterator
- func (tx *Tx) RangeLimitIterator(min []byte, max []byte, rangeType uint8, offset int, count int) *RangeLimitIterator
- func (tx *Tx) RevRangeIterator(min []byte, max []byte, rangeType uint8) *RangeLimitIterator
- func (tx *Tx) RevRangeLimitIterator(min []byte, max []byte, rangeType uint8, offset int, count int) *RangeLimitIterator
- func (tx *Tx) Rollback() error
- type WriteBatch
Constants ¶
const ( IteratorForward uint8 = 0 IteratorBackward uint8 = 1 )
const ( RangeClose uint8 = 0x00 RangeLOpen uint8 = 0x01 RangeROpen uint8 = 0x10 RangeOpen uint8 = 0x11 )
const BatchDataHeadLen = 12
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BatchData ¶
func NewBatchData ¶
func (*BatchData) Replay ¶
func (d *BatchData) Replay(r BatchDataReplay) error
type BatchDataReplay ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) NewIterator ¶
func (*DB) NewSnapshot ¶
func (*DB) NewWriteBatch ¶
func (db *DB) NewWriteBatch() *WriteBatch
func (*DB) RangeIterator ¶
func (db *DB) RangeIterator(min []byte, max []byte, rangeType uint8) *RangeLimitIterator
func (*DB) RangeLimitIterator ¶
func (db *DB) RangeLimitIterator(min []byte, max []byte, rangeType uint8, offset int, count int) *RangeLimitIterator
count < 0, unlimit.
offset must >= 0, if < 0, will get nothing.
func (*DB) RevRangeIterator ¶
func (db *DB) RevRangeIterator(min []byte, max []byte, rangeType uint8) *RangeLimitIterator
func (*DB) RevRangeLimitIterator ¶
func (db *DB) RevRangeLimitIterator(min []byte, max []byte, rangeType uint8, offset int, count int) *RangeLimitIterator
count < 0, unlimit.
offset must >= 0, if < 0, will get nothing.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
func (*Iterator) RawFind ¶
Finds by key, if not found, nil returns, else a reference of value returns. you must be careful that it will be changed after next iterate.
func (*Iterator) RawKey ¶
Returns a reference of key. you must be careful that it will be changed after next iterate.
func (*Iterator) RawValue ¶
Returns a reference of value. you must be careful that it will be changed after next iterate.
func (*Iterator) SeekToFirst ¶
func (it *Iterator) SeekToFirst()
func (*Iterator) SeekToLast ¶
func (it *Iterator) SeekToLast()
type Range ¶
min must less or equal than max
range type:
close: [min, max] open: (min, max) lopen: (min, max] ropen: [min, max)
type RangeLimitIterator ¶
type RangeLimitIterator struct {
// contains filtered or unexported fields
}
func NewRangeIterator ¶
func NewRangeIterator(i *Iterator, r *Range) *RangeLimitIterator
func NewRangeLimitIterator ¶
func NewRangeLimitIterator(i *Iterator, r *Range, l *Limit) *RangeLimitIterator
func NewRevRangeIterator ¶
func NewRevRangeIterator(i *Iterator, r *Range) *RangeLimitIterator
func NewRevRangeLimitIterator ¶
func NewRevRangeLimitIterator(i *Iterator, r *Range, l *Limit) *RangeLimitIterator
func (*RangeLimitIterator) BufKey ¶
func (it *RangeLimitIterator) BufKey(b []byte) []byte
func (*RangeLimitIterator) BufValue ¶
func (it *RangeLimitIterator) BufValue(b []byte) []byte
func (*RangeLimitIterator) Close ¶
func (it *RangeLimitIterator) Close()
func (*RangeLimitIterator) Key ¶
func (it *RangeLimitIterator) Key() []byte
func (*RangeLimitIterator) Next ¶
func (it *RangeLimitIterator) Next()
func (*RangeLimitIterator) RawKey ¶
func (it *RangeLimitIterator) RawKey() []byte
func (*RangeLimitIterator) RawValue ¶
func (it *RangeLimitIterator) RawValue() []byte
func (*RangeLimitIterator) Valid ¶
func (it *RangeLimitIterator) Valid() bool
func (*RangeLimitIterator) Value ¶
func (it *RangeLimitIterator) Value() []byte
type Snapshot ¶
func (*Snapshot) NewIterator ¶
type Stat ¶
type Stat struct { GetNum sync2.AtomicInt64 GetMissingNum sync2.AtomicInt64 GetTotalTime sync2.AtomicDuration PutNum sync2.AtomicInt64 DeleteNum sync2.AtomicInt64 IterNum sync2.AtomicInt64 IterSeekNum sync2.AtomicInt64 IterCloseNum sync2.AtomicInt64 SnapshotNum sync2.AtomicInt64 SnapshotCloseNum sync2.AtomicInt64 BatchNum sync2.AtomicInt64 BatchCommitNum sync2.AtomicInt64 BatchCommitTotalTime sync2.AtomicDuration TxNum sync2.AtomicInt64 TxCommitNum sync2.AtomicInt64 TxCloseNum sync2.AtomicInt64 CompactNum sync2.AtomicInt64 CompactTotalTime sync2.AtomicDuration }
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
func (*Tx) NewIterator ¶
func (*Tx) NewWriteBatch ¶
func (tx *Tx) NewWriteBatch() *WriteBatch
func (*Tx) RangeIterator ¶
func (tx *Tx) RangeIterator(min []byte, max []byte, rangeType uint8) *RangeLimitIterator
func (*Tx) RangeLimitIterator ¶
func (tx *Tx) RangeLimitIterator(min []byte, max []byte, rangeType uint8, offset int, count int) *RangeLimitIterator
count < 0, unlimit.
offset must >= 0, if < 0, will get nothing.
func (*Tx) RevRangeIterator ¶
func (tx *Tx) RevRangeIterator(min []byte, max []byte, rangeType uint8) *RangeLimitIterator
func (*Tx) RevRangeLimitIterator ¶
func (tx *Tx) RevRangeLimitIterator(min []byte, max []byte, rangeType uint8, offset int, count int) *RangeLimitIterator
count < 0, unlimit.
offset must >= 0, if < 0, will get nothing.
type WriteBatch ¶
type WriteBatch struct {
// contains filtered or unexported fields
}
func (*WriteBatch) BatchData ¶
func (wb *WriteBatch) BatchData() *BatchData
the data will be undefined after commit or rollback
func (*WriteBatch) Close ¶
func (wb *WriteBatch) Close()
func (*WriteBatch) Commit ¶
func (wb *WriteBatch) Commit() error
func (*WriteBatch) Data ¶
func (wb *WriteBatch) Data() []byte
func (*WriteBatch) Delete ¶
func (wb *WriteBatch) Delete(key []byte)
func (*WriteBatch) Put ¶
func (wb *WriteBatch) Put(key []byte, value []byte)
func (*WriteBatch) Rollback ¶
func (wb *WriteBatch) Rollback() error