engine

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// for data
	KVType   byte = 21
	HashType byte = 22
)

make sure keep the same with rockredis

Variables

This section is empty.

Functions

func FillDefaultOptions

func FillDefaultOptions(opts *RockOptions)

func SetLogLevel

func SetLogLevel(level int32)

func SetLogger

func SetLogger(level int32, logger common.Logger)

Types

type DBIterator

type DBIterator struct {
	*gorocksdb.Iterator
	// contains filtered or unexported fields
}

func NewDBIterator

func NewDBIterator(db *gorocksdb.DB, withSnap bool, prefixSame bool, lowbound []byte, upbound []byte, ignoreDel bool) (*DBIterator, error)

low_bound is inclusive upper bound is exclusive

func (*DBIterator) Close

func (it *DBIterator) Close()

func (*DBIterator) Key

func (it *DBIterator) Key() []byte

func (*DBIterator) NoTimestamp

func (it *DBIterator) NoTimestamp(vt byte)

func (*DBIterator) RefKey

func (it *DBIterator) RefKey() []byte

the bytes returned will be freed after next

func (*DBIterator) RefValue

func (it *DBIterator) RefValue() []byte

the bytes returned will be freed after next

func (*DBIterator) Value

func (it *DBIterator) Value() []byte

type Iterator

type Iterator interface {
	Next()
	Prev()
	Valid() bool
	Seek([]byte)
	SeekForPrev([]byte)
	SeekToFirst()
	SeekToLast()
	Close()
	RefKey() []byte
	Key() []byte
	RefValue() []byte
	Value() []byte
	NoTimestamp(vt byte)
}

type IteratorOpts

type IteratorOpts struct {
	Range
	Limit
	Reverse   bool
	IgnoreDel bool
	WithSnap  bool
}

type Limit

type Limit struct {
	Offset int
	Count  int
}

type Range

type Range struct {
	Min  []byte
	Max  []byte
	Type uint8
}

type RangeLimitedIterator

type RangeLimitedIterator struct {
	Iterator
	// contains filtered or unexported fields
}

func NewDBRangeIterator

func NewDBRangeIterator(db *gorocksdb.DB, min []byte, max []byte, rtype uint8,
	reverse bool) (*RangeLimitedIterator, error)

func NewDBRangeIteratorWithOpts

func NewDBRangeIteratorWithOpts(db *gorocksdb.DB, opts IteratorOpts) (*RangeLimitedIterator, error)

func NewDBRangeLimitIterator

func NewDBRangeLimitIterator(db *gorocksdb.DB, min []byte, max []byte, rtype uint8,
	offset int, count int, reverse bool) (*RangeLimitedIterator, 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(db *gorocksdb.DB, opts IteratorOpts) (*RangeLimitedIterator, error)

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 NewSnapshotDBRangeIterator

func NewSnapshotDBRangeIterator(db *gorocksdb.DB, min []byte, max []byte, rtype uint8,
	reverse bool) (*RangeLimitedIterator, error)

func NewSnapshotDBRangeLimitIterator

func NewSnapshotDBRangeLimitIterator(db *gorocksdb.DB, min []byte, max []byte, rtype uint8,
	offset int, count int, reverse bool) (*RangeLimitedIterator, error)

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 (r *RockEng) AddDeletedCnt(c int64)

func (*RockEng) CloseAll

func (r *RockEng) CloseAll()

func (*RockEng) CloseEng

func (r *RockEng) CloseEng() bool

func (*RockEng) CompactRange

func (r *RockEng) CompactRange()

func (*RockEng) DeletedBeforeCompact

func (r *RockEng) DeletedBeforeCompact() int64

func (*RockEng) Eng

func (r *RockEng) Eng() *gorocksdb.DB

func (*RockEng) GetDataDir

func (r *RockEng) GetDataDir() string

func (*RockEng) GetInternalPropertyStatus

func (r *RockEng) GetInternalPropertyStatus(p string) string

func (*RockEng) GetInternalStatus

func (r *RockEng) GetInternalStatus() map[string]interface{}

func (*RockEng) GetOpts

func (r *RockEng) GetOpts() *gorocksdb.Options

func (*RockEng) GetStatistics

func (r *RockEng) GetStatistics() string

func (*RockEng) GetValueWithOp added in v0.7.1

func (r *RockEng) GetValueWithOp(opts *gorocksdb.ReadOptions, key []byte,
	op func([]byte) error) error

func (*RockEng) GetValueWithOpNoLock added in v0.7.1

func (r *RockEng) GetValueWithOpNoLock(opts *gorocksdb.ReadOptions, key []byte,
	op func([]byte) error) error

func (*RockEng) LastCompactTime

func (r *RockEng) LastCompactTime() int64

func (*RockEng) OpenEng

func (r *RockEng) OpenEng() error

func (*RockEng) SetMaxBackgroundOptions added in v0.7.1

func (r *RockEng) SetMaxBackgroundOptions(maxCompact int, maxBackJobs int) error

type RockEngConfig

type RockEngConfig struct {
	DataDir            string
	SharedConfig       *SharedRockConfig
	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"`
	UseSharedCache                 bool   `json:"use_shared_cache,omitempty"`
	UseSharedRateLimiter           bool   `json:"use_shared_rate_limiter,omitempty"`
	DisableWAL                     bool   `json:"disable_wal,omitempty"`
	DisableMergeCounter            bool   `json:"disable_merge_counter,omitempty"`
	OptimizeFiltersForHits         bool   `json:"optimize_filters_for_hits,omitempty"`
	InsertHintFixedLen             int    `json:"insert_hint_fixed_len"`
}

type SharedRockConfig

type SharedRockConfig struct {
	SharedCache       *gorocksdb.Cache
	SharedEnv         *gorocksdb.Env
	SharedRateLimiter *gorocksdb.RateLimiter
}

func NewSharedRockConfig

func NewSharedRockConfig(opt RockOptions) *SharedRockConfig

func (*SharedRockConfig) Destroy

func (src *SharedRockConfig) Destroy()

Jump to

Keyboard shortcuts

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