corekv

package module
v0.0.0-...-8eacd36 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: MIT Imports: 21 Imported by: 0

README

corekv

corekv 是一个用来高效率的验证kv引擎feature的项目。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoreAPI

type CoreAPI interface {
	Set(data *utils.Entry) error
	Get(key []byte) (*utils.Entry, error)
	Del(key []byte) error
	NewIterator(opt *utils.Options) utils.Iterator
	Info() *Stats
	Close() error
}

coreKV对外提供的功能集合

type DB

type DB struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

DB 对外暴露的接口对象 全局唯一,持有各种资源句柄

func Open

func Open(opt *Options) *DB

* SSTableMaxSz: 1024, MemTableSize: 1024, BlockSize: 1024, BloomFalsePositive: 0, BaseLevelSize: 10 << 20, LevelSizeMultiplier: 10, BaseTableSize: 2 << 20, TableSizeMultiplier: 2, NumLevelZeroTables: 15, MaxLevelNum: 7, NumCompactors: 3,

Open DB TODO 这里是不是要上一个目录锁比较好,防止多个进程打开同一个目录?

func (*DB) Close

func (db *DB) Close() error

func (*DB) Del

func (db *DB) Del(key []byte) error

func (*DB) Get

func (db *DB) Get(key []byte) (*utils.Entry, error)

func (*DB) Info

func (db *DB) Info() *Stats

func (*DB) NewIterator

func (db *DB) NewIterator(opt *utils.Options) utils.Iterator

func (*DB) RunValueLogGC

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

RunValueLogGC triggers a value log garbage collection.

func (*DB) Set

func (db *DB) Set(data *utils.Entry) error

type DBIterator

type DBIterator struct {
	// contains filtered or unexported fields
}

func (*DBIterator) Close

func (iter *DBIterator) Close() error

func (*DBIterator) Item

func (iter *DBIterator) Item() utils.Item

func (*DBIterator) Next

func (iter *DBIterator) Next()

func (*DBIterator) Rewind

func (iter *DBIterator) Rewind()

func (*DBIterator) Seek

func (iter *DBIterator) Seek(key []byte)

func (*DBIterator) Valid

func (iter *DBIterator) Valid() bool

type Item

type Item struct {
	// contains filtered or unexported fields
}

func (*Item) Entry

func (it *Item) Entry() *utils.Entry

type Options

type Options struct {
	ValueThreshold      int64
	WorkDir             string
	MemTableSize        int64
	SSTableMaxSz        int64
	MaxBatchCount       int64
	MaxBatchSize        int64 // max batch size in bytes
	ValueLogFileSize    int
	VerifyValueChecksum bool
	ValueLogMaxEntries  uint32
	LogRotatesToFlush   int32
	MaxTableSize        int64
}

Options corekv 总的配置文件

func NewDefaultOptions

func NewDefaultOptions() *Options

NewDefaultOptions 返回默认的options

type Stats

type Stats struct {
	EntryNum int64 // 存储多少个kv数据
	// contains filtered or unexported fields
}

func (*Stats) StartStats

func (s *Stats) StartStats()

StartStats

Directories

Path Synopsis
mmap
Mmap uses the mmap system call to memory-map a file.
Mmap uses the mmap system call to memory-map a file.

Jump to

Keyboard shortcuts

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