Documentation ¶
Index ¶
- Constants
- func FillDefaultOptions(opts *RockOptions)
- func GetDataDirFromBase(engType string, base string) (string, error)
- func GetRocksdbUint64(v []byte, err error) (uint64, error)
- func NewMemEng(cfg *RockEngConfig) (*memEng, error)
- func NewRadix() (*radixMemIndex, error)
- func NewSkipList() *skipList
- func SetLogLevel(level int32)
- func SetLogger(level int32, logger common.Logger)
- type CRange
- type ICompactFilter
- type Iterator
- type IteratorGetter
- type IteratorOpts
- type KVCheckpoint
- type KVEngine
- type Limit
- type PebbleEng
- func (pe *PebbleEng) AddDeletedCnt(c int64)
- func (pe *PebbleEng) CheckDBEngForRead(fullPath string) error
- func (pe *PebbleEng) CloseAll()
- func (pe *PebbleEng) CloseEng() bool
- func (pe *PebbleEng) CompactAllRange()
- func (pe *PebbleEng) CompactRange(rg CRange)
- func (pe *PebbleEng) DefaultWriteBatch() WriteBatch
- func (pe *PebbleEng) DeleteFilesInRange(rg CRange)
- func (pe *PebbleEng) DeletedBeforeCompact() int64
- func (pe *PebbleEng) DisableManualCompact(disable bool)
- func (pe *PebbleEng) Exist(key []byte) (bool, error)
- func (pe *PebbleEng) ExistNoLock(key []byte) (bool, error)
- func (pe *PebbleEng) GetApproximateKeyNum(ranges []CRange) uint64
- func (pe *PebbleEng) GetApproximateSizes(ranges []CRange, includeMem bool) []uint64
- func (pe *PebbleEng) GetApproximateTotalKeyNum() int
- func (pe *PebbleEng) GetBytes(key []byte) ([]byte, error)
- func (pe *PebbleEng) GetBytesNoLock(key []byte) ([]byte, error)
- func (pe *PebbleEng) GetDataDir() string
- func (pe *PebbleEng) GetInternalPropertyStatus(p string) string
- func (pe *PebbleEng) GetInternalStatus() map[string]interface{}
- func (pe *PebbleEng) GetIterator(opts IteratorOpts) (Iterator, error)
- func (pe *PebbleEng) GetRef(key []byte) (RefSlice, error)
- func (pe *PebbleEng) GetRefNoLock(key []byte) (RefSlice, error)
- func (pe *PebbleEng) GetStatistics() string
- func (pe *PebbleEng) GetValueWithOp(key []byte, op func([]byte) error) error
- func (pe *PebbleEng) GetValueWithOpNoLock(key []byte, op func([]byte) error) error
- func (pe *PebbleEng) IsClosed() bool
- func (pe *PebbleEng) LastCompactTime() int64
- func (pe *PebbleEng) MultiGetBytes(keyList [][]byte, values [][]byte, errs []error)
- func (pe *PebbleEng) NewCheckpoint(printToStdoutAlso bool) (KVCheckpoint, error)
- func (pe *PebbleEng) NewWriteBatch() WriteBatch
- func (pe *PebbleEng) OpenEng() error
- func (pe *PebbleEng) SetCompactionFilter(ICompactFilter)
- func (pe *PebbleEng) SetMaxBackgroundOptions(maxCompact int, maxBackJobs int) error
- func (pe *PebbleEng) SetOptsForLogStorage()
- func (pe *PebbleEng) Write(wb WriteBatch) error
- type Range
- type RangeLimitedIterator
- func NewDBRangeIteratorWithOpts(ig IteratorGetter, opts IteratorOpts) (rit *RangeLimitedIterator, err error)
- func NewDBRangeLimitIteratorWithOpts(ig IteratorGetter, opts IteratorOpts) (rit *RangeLimitedIterator, err error)
- func NewRangeIterator(i Iterator, r *Range) *RangeLimitedIterator
- func NewRangeLimitIterator(i Iterator, r *Range, l *Limit) *RangeLimitedIterator
- func NewRevRangeIterator(i Iterator, r *Range) *RangeLimitedIterator
- func NewRevRangeLimitIterator(i Iterator, r *Range, l *Limit) *RangeLimitedIterator
- type RefSlice
- type RockEng
- func (r *RockEng) AddDeletedCnt(c int64)
- func (r *RockEng) CheckDBEngForRead(fullPath string) error
- func (r *RockEng) CloseAll()
- func (r *RockEng) CloseEng() bool
- func (r *RockEng) CompactAllRange()
- func (r *RockEng) CompactRange(rg CRange)
- func (r *RockEng) DefaultWriteBatch() WriteBatch
- func (r *RockEng) DeleteFilesInRange(rg CRange)
- func (r *RockEng) DeletedBeforeCompact() int64
- func (r *RockEng) DisableManualCompact(disable bool)
- func (r *RockEng) Exist(key []byte) (bool, error)
- func (r *RockEng) ExistNoLock(key []byte) (bool, error)
- func (r *RockEng) GetApproximateKeyNum(ranges []CRange) uint64
- func (r *RockEng) GetApproximateSizes(ranges []CRange, includeMem bool) []uint64
- func (r *RockEng) GetApproximateTotalKeyNum() int
- func (r *RockEng) GetBytes(key []byte) ([]byte, error)
- func (r *RockEng) GetBytesNoLock(key []byte) ([]byte, error)
- func (r *RockEng) GetDataDir() string
- func (r *RockEng) GetInternalPropertyStatus(p string) string
- func (r *RockEng) GetInternalStatus() map[string]interface{}
- func (r *RockEng) GetIterator(opts IteratorOpts) (Iterator, error)
- func (r *RockEng) GetOpts() *gorocksdb.Options
- func (r *RockEng) GetRef(key []byte) (RefSlice, error)
- func (r *RockEng) GetRefNoLock(key []byte) (RefSlice, error)
- func (r *RockEng) GetStatistics() string
- func (r *RockEng) GetValueWithOp(key []byte, op func([]byte) error) error
- func (r *RockEng) GetValueWithOpNoLock(key []byte, op func([]byte) error) error
- func (r *RockEng) IsClosed() bool
- func (r *RockEng) LastCompactTime() int64
- func (r *RockEng) MultiGetBytes(keyList [][]byte, values [][]byte, errs []error)
- func (r *RockEng) NewCheckpoint(printToStdoutAlso bool) (KVCheckpoint, error)
- func (r *RockEng) NewWriteBatch() WriteBatch
- func (r *RockEng) OpenEng() error
- func (r *RockEng) SetCompactionFilter(filter ICompactFilter)
- func (r *RockEng) SetMaxBackgroundOptions(maxCompact int, maxBackJobs int) error
- func (r *RockEng) SetOptsForLogStorage()
- func (r *RockEng) Write(wb WriteBatch) error
- type RockEngConfig
- type RockOptions
- type SharedRockConfig
- type SkipListIterator
- func (iter *SkipListIterator) Close()
- func (iter *SkipListIterator) First()
- func (iter *SkipListIterator) Key() []byte
- func (iter *SkipListIterator) Last()
- func (iter *SkipListIterator) Next()
- func (iter *SkipListIterator) Prev()
- func (iter *SkipListIterator) Seek(key []byte)
- func (iter *SkipListIterator) SeekForPrev(key []byte)
- func (iter *SkipListIterator) Valid() bool
- func (iter *SkipListIterator) Value() []byte
- type Uint64AddMerger
- type WriteBatch
Constants ¶
const ( // for data KVType byte = 21 HashType byte = 22 )
make sure keep the same with rockredis
const ( NotOp wop = iota DeleteOp PutOp MergeOp DeleteRangeOp )
Variables ¶
This section is empty.
Functions ¶
func FillDefaultOptions ¶
func FillDefaultOptions(opts *RockOptions)
func GetDataDirFromBase ¶ added in v0.9.2
func NewMemEng ¶ added in v0.9.0
func NewMemEng(cfg *RockEngConfig) (*memEng, error)
func NewSkipList ¶ added in v0.9.0
func NewSkipList() *skipList
func SetLogLevel ¶
func SetLogLevel(level int32)
Types ¶
type ICompactFilter ¶ added in v0.9.2
type IteratorGetter ¶ added in v0.9.0
type IteratorGetter interface {
GetIterator(IteratorOpts) (Iterator, error)
}
type IteratorOpts ¶
type KVCheckpoint ¶ added in v0.9.0
type KVEngine ¶ added in v0.9.0
type KVEngine interface { NewWriteBatch() WriteBatch DefaultWriteBatch() WriteBatch GetDataDir() string SetMaxBackgroundOptions(maxCompact int, maxBackJobs int) error CheckDBEngForRead(fullPath string) error OpenEng() error Write(wb WriteBatch) error DeletedBeforeCompact() int64 AddDeletedCnt(c int64) LastCompactTime() int64 CompactRange(rg CRange) CompactAllRange() DisableManualCompact(bool) GetApproximateTotalKeyNum() int GetApproximateKeyNum(ranges []CRange) uint64 GetApproximateSizes(ranges []CRange, includeMem bool) []uint64 IsClosed() bool CloseEng() bool CloseAll() GetStatistics() string GetInternalStatus() map[string]interface{} GetInternalPropertyStatus(p string) string GetBytesNoLock(key []byte) ([]byte, error) GetBytes(key []byte) ([]byte, error) MultiGetBytes(keyList [][]byte, values [][]byte, errs []error) Exist(key []byte) (bool, error) ExistNoLock(key []byte) (bool, error) GetRef(key []byte) (RefSlice, error) GetRefNoLock(key []byte) (RefSlice, error) GetValueWithOp(key []byte, op func([]byte) error) error GetValueWithOpNoLock(key []byte, op func([]byte) error) error DeleteFilesInRange(rg CRange) GetIterator(opts IteratorOpts) (Iterator, error) NewCheckpoint(printToStdoutAlso bool) (KVCheckpoint, error) SetOptsForLogStorage() SetCompactionFilter(ICompactFilter) }
func NewKVEng ¶ added in v0.9.0
func NewKVEng(cfg *RockEngConfig) (KVEngine, error)
type PebbleEng ¶ added in v0.9.0
type PebbleEng struct {
// contains filtered or unexported fields
}
func NewPebbleEng ¶ added in v0.9.0
func NewPebbleEng(cfg *RockEngConfig) (*PebbleEng, error)
func (*PebbleEng) AddDeletedCnt ¶ added in v0.9.0
func (*PebbleEng) CheckDBEngForRead ¶ added in v0.9.0
func (*PebbleEng) CompactAllRange ¶ added in v0.9.0
func (pe *PebbleEng) CompactAllRange()
func (*PebbleEng) CompactRange ¶ added in v0.9.0
func (*PebbleEng) DefaultWriteBatch ¶ added in v0.9.0
func (pe *PebbleEng) DefaultWriteBatch() WriteBatch
func (*PebbleEng) DeleteFilesInRange ¶ added in v0.9.0
func (*PebbleEng) DeletedBeforeCompact ¶ added in v0.9.0
func (*PebbleEng) DisableManualCompact ¶ added in v0.9.2
func (*PebbleEng) ExistNoLock ¶ added in v0.9.0
func (*PebbleEng) GetApproximateKeyNum ¶ added in v0.9.0
func (*PebbleEng) GetApproximateSizes ¶ added in v0.9.0
func (*PebbleEng) GetApproximateTotalKeyNum ¶ added in v0.9.0
func (*PebbleEng) GetBytesNoLock ¶ added in v0.9.0
func (*PebbleEng) GetDataDir ¶ added in v0.9.0
func (*PebbleEng) GetInternalPropertyStatus ¶ added in v0.9.0
func (*PebbleEng) GetInternalStatus ¶ added in v0.9.0
func (*PebbleEng) GetIterator ¶ added in v0.9.0
func (pe *PebbleEng) GetIterator(opts IteratorOpts) (Iterator, error)
func (*PebbleEng) GetRefNoLock ¶ added in v0.9.0
func (*PebbleEng) GetStatistics ¶ added in v0.9.0
func (*PebbleEng) GetValueWithOp ¶ added in v0.9.0
func (*PebbleEng) GetValueWithOpNoLock ¶ added in v0.9.0
func (*PebbleEng) LastCompactTime ¶ added in v0.9.0
func (*PebbleEng) MultiGetBytes ¶ added in v0.9.0
func (*PebbleEng) NewCheckpoint ¶ added in v0.9.0
func (pe *PebbleEng) NewCheckpoint(printToStdoutAlso bool) (KVCheckpoint, error)
func (*PebbleEng) NewWriteBatch ¶ added in v0.9.0
func (pe *PebbleEng) NewWriteBatch() WriteBatch
func (*PebbleEng) SetCompactionFilter ¶ added in v0.9.2
func (pe *PebbleEng) SetCompactionFilter(ICompactFilter)
func (*PebbleEng) SetMaxBackgroundOptions ¶ added in v0.9.0
func (*PebbleEng) SetOptsForLogStorage ¶ added in v0.9.0
func (pe *PebbleEng) SetOptsForLogStorage()
func (*PebbleEng) Write ¶ added in v0.9.0
func (pe *PebbleEng) Write(wb WriteBatch) error
type RangeLimitedIterator ¶
type RangeLimitedIterator struct { Iterator // contains filtered or unexported fields }
func NewDBRangeIteratorWithOpts ¶
func NewDBRangeIteratorWithOpts(ig IteratorGetter, opts IteratorOpts) (rit *RangeLimitedIterator, err error)
note: all the iterator use the prefix iterator flag. Which means it may skip the keys for different table prefix.
func NewDBRangeLimitIteratorWithOpts ¶
func NewDBRangeLimitIteratorWithOpts(ig IteratorGetter, opts IteratorOpts) (rit *RangeLimitedIterator, err error)
note: all the iterator use the prefix iterator flag. Which means it may skip the keys for different table prefix.
func NewRangeIterator ¶
func NewRangeIterator(i Iterator, r *Range) *RangeLimitedIterator
func NewRangeLimitIterator ¶
func NewRangeLimitIterator(i Iterator, r *Range, l *Limit) *RangeLimitedIterator
func NewRevRangeIterator ¶
func NewRevRangeIterator(i Iterator, r *Range) *RangeLimitedIterator
func NewRevRangeLimitIterator ¶
func NewRevRangeLimitIterator(i Iterator, r *Range, l *Limit) *RangeLimitedIterator
func (*RangeLimitedIterator) Next ¶
func (it *RangeLimitedIterator) Next()
func (*RangeLimitedIterator) Valid ¶
func (it *RangeLimitedIterator) Valid() bool
type RockEng ¶
type RockEng struct {
// contains filtered or unexported fields
}
func NewRockEng ¶
func NewRockEng(cfg *RockEngConfig) (*RockEng, error)
func (*RockEng) AddDeletedCnt ¶
func (*RockEng) CheckDBEngForRead ¶ added in v0.9.0
func (*RockEng) CompactAllRange ¶ added in v0.9.0
func (r *RockEng) CompactAllRange()
func (*RockEng) CompactRange ¶
func (*RockEng) DefaultWriteBatch ¶ added in v0.9.0
func (r *RockEng) DefaultWriteBatch() WriteBatch
DefaultWriteBatch return the internal default write batch for write, should only call this after the engine opened and can not be used concurrently
func (*RockEng) DeleteFilesInRange ¶ added in v0.9.0
func (*RockEng) DeletedBeforeCompact ¶
func (*RockEng) DisableManualCompact ¶ added in v0.9.2
func (*RockEng) ExistNoLock ¶ added in v0.9.0
func (*RockEng) GetApproximateKeyNum ¶ added in v0.9.0
func (*RockEng) GetApproximateSizes ¶ added in v0.9.0
func (*RockEng) GetApproximateTotalKeyNum ¶ added in v0.9.0
func (*RockEng) GetBytesNoLock ¶ added in v0.9.0
func (*RockEng) GetDataDir ¶
func (*RockEng) GetInternalPropertyStatus ¶
func (*RockEng) GetInternalStatus ¶
func (*RockEng) GetIterator ¶ added in v0.9.0
func (r *RockEng) GetIterator(opts IteratorOpts) (Iterator, error)
func (*RockEng) GetRefNoLock ¶ added in v0.9.0
func (*RockEng) GetStatistics ¶
func (*RockEng) GetValueWithOp ¶ added in v0.7.1
func (*RockEng) GetValueWithOpNoLock ¶ added in v0.7.1
func (*RockEng) LastCompactTime ¶
func (*RockEng) MultiGetBytes ¶ added in v0.9.0
func (*RockEng) NewCheckpoint ¶ added in v0.9.0
func (r *RockEng) NewCheckpoint(printToStdoutAlso bool) (KVCheckpoint, error)
func (*RockEng) NewWriteBatch ¶ added in v0.9.0
func (r *RockEng) NewWriteBatch() WriteBatch
NewWriteBatch init a new write batch for write, should only call this after the engine opened
func (*RockEng) SetCompactionFilter ¶ added in v0.9.2
func (r *RockEng) SetCompactionFilter(filter ICompactFilter)
func (*RockEng) SetMaxBackgroundOptions ¶ added in v0.7.1
func (*RockEng) SetOptsForLogStorage ¶ added in v0.9.0
func (r *RockEng) SetOptsForLogStorage()
func (*RockEng) Write ¶ added in v0.9.0
func (r *RockEng) Write(wb WriteBatch) error
type RockEngConfig ¶
type RockEngConfig struct { DataDir string ReadOnly bool DataTool bool EnableTableCounter bool AutoCompacted bool RockOptions }
func NewRockConfig ¶
func NewRockConfig() *RockEngConfig
type RockOptions ¶
type RockOptions struct { VerifyReadChecksum bool `json:"verify_read_checksum"` BlockSize int `json:"block_size"` BlockCache int64 `json:"block_cache"` CacheIndexAndFilterBlocks bool `json:"cache_index_and_filter_blocks"` EnablePartitionedIndexFilter bool `json:"enable_partitioned_index_filter"` WriteBufferSize int `json:"write_buffer_size"` MaxWriteBufferNumber int `json:"max_write_buffer_number"` MinWriteBufferNumberToMerge int `json:"min_write_buffer_number_to_merge"` Level0FileNumCompactionTrigger int `json:"level0_file_num_compaction_trigger"` MaxBytesForLevelBase uint64 `json:"max_bytes_for_level_base"` TargetFileSizeBase uint64 `json:"target_file_size_base"` MaxBackgroundFlushes int `json:"max_background_flushes"` MaxBackgroundCompactions int `json:"max_background_compactions"` MinLevelToCompress int `json:"min_level_to_compress"` MaxMainifestFileSize uint64 `json:"max_mainifest_file_size"` RateBytesPerSec int64 `json:"rate_bytes_per_sec"` BackgroundHighThread int `json:"background_high_thread,omitempty"` BackgroundLowThread int `json:"background_low_thread,omitempty"` AdjustThreadPool bool `json:"adjust_thread_pool,omitempty"` DisableWAL bool `json:"disable_wal,omitempty"` DisableMergeCounter bool `json:"disable_merge_counter,omitempty"` OptimizeFiltersForHits bool `json:"optimize_filters_for_hits,omitempty"` // note do not change this dynamic for existing db LevelCompactionDynamicLevelBytes bool `json:"level_compaction_dynamic_level_bytes,omitempty"` InsertHintFixedLen int `json:"insert_hint_fixed_len"` EngineType string `json:"engine_type,omitempty"` }
type SharedRockConfig ¶
type SharedRockConfig interface {}
func NewSharedEngConfig ¶ added in v0.9.0
func NewSharedEngConfig(cfg RockOptions) (SharedRockConfig, error)
type SkipListIterator ¶ added in v0.9.0
type SkipListIterator struct {
// contains filtered or unexported fields
}
func (*SkipListIterator) Close ¶ added in v0.9.0
func (iter *SkipListIterator) Close()
Close closes the iterator.
func (*SkipListIterator) First ¶ added in v0.9.0
func (iter *SkipListIterator) First()
SeekToFirst moves the iterator to the first key in the database.
func (*SkipListIterator) Key ¶ added in v0.9.0
func (iter *SkipListIterator) Key() []byte
Key returns the key the iterator currently holds.
func (*SkipListIterator) Last ¶ added in v0.9.0
func (iter *SkipListIterator) Last()
SeekToLast moves the iterator to the last key in the database.
func (*SkipListIterator) Next ¶ added in v0.9.0
func (iter *SkipListIterator) Next()
Next moves the iterator to the next sequential key in the database.
func (*SkipListIterator) Prev ¶ added in v0.9.0
func (iter *SkipListIterator) Prev()
Prev moves the iterator to the previous sequential key in the database.
func (*SkipListIterator) Seek ¶ added in v0.9.0
func (iter *SkipListIterator) Seek(key []byte)
Seek moves the iterator to the position greater than or equal to the key.
func (*SkipListIterator) SeekForPrev ¶ added in v0.9.0
func (iter *SkipListIterator) SeekForPrev(key []byte)
seek to the last key that less than or equal to the target key while enable prefix_extractor, use seek() and prev() doesn't work if seek to the end of the prefix range. use this seekforprev instead
func (*SkipListIterator) Valid ¶ added in v0.9.0
func (iter *SkipListIterator) Valid() bool
Valid returns false only when an Iterator has iterated past either the first or the last key in the database.
func (*SkipListIterator) Value ¶ added in v0.9.0
func (iter *SkipListIterator) Value() []byte
Value returns the value in the database the iterator currently holds.
type Uint64AddMerger ¶ added in v0.9.0
type Uint64AddMerger struct {
// contains filtered or unexported fields
}
func (*Uint64AddMerger) Finish ¶ added in v0.9.0
func (m *Uint64AddMerger) Finish() ([]byte, io.Closer, error)
func (*Uint64AddMerger) MergeNewer ¶ added in v0.9.0
func (m *Uint64AddMerger) MergeNewer(value []byte) error
func (*Uint64AddMerger) MergeOlder ¶ added in v0.9.0
func (m *Uint64AddMerger) MergeOlder(value []byte) error