lsm

package
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: 23 Imported by: 0

Documentation

Overview

Copyright 2021 hardcore-os Project Authors

Licensed under the Apache License, Version 2.0 (the "License") you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDeletedOrExpired

func IsDeletedOrExpired(e *utils.Entry) bool

判断是否过期 是可删除

func NewMergeIterator

func NewMergeIterator(iters []utils.Iterator, reverse bool) utils.Iterator

NewMergeIterator creates a merge iterator.

Types

type ConcatIterator

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

ConcatIterator 将table 数组链接成一个迭代器,这样迭代效率更高

func NewConcatIterator

func NewConcatIterator(tbls []*table, opt *utils.Options) *ConcatIterator

NewConcatIterator creates a new concatenated iterator

func (*ConcatIterator) Close

func (s *ConcatIterator) Close() error

Close implements y.Interface.

func (*ConcatIterator) Item

func (s *ConcatIterator) Item() utils.Item

Item _

func (*ConcatIterator) Next

func (s *ConcatIterator) Next()

Next advances our concat iterator.

func (*ConcatIterator) Rewind

func (s *ConcatIterator) Rewind()

Rewind implements Interface

func (*ConcatIterator) Seek

func (s *ConcatIterator) Seek(key []byte)

Seek brings us to element >= key if reversed is false. Otherwise, <= key.

func (*ConcatIterator) Valid

func (s *ConcatIterator) Valid() bool

Valid implements y.Interface

type Item

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

func (*Item) Entry

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

type Iterator

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

func (*Iterator) Close

func (iter *Iterator) Close() error

func (*Iterator) Item

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

func (*Iterator) Next

func (iter *Iterator) Next()

func (*Iterator) Rewind

func (iter *Iterator) Rewind()

func (*Iterator) Seek

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

func (*Iterator) Valid

func (iter *Iterator) Valid() bool

type LSM

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

LSM _

func NewLSM

func NewLSM(opt *Options) *LSM

NewLSM _

func (*LSM) Close

func (lsm *LSM) Close() error

Close _

func (*LSM) Get

func (lsm *LSM) Get(key []byte) (*utils.Entry, error)

Get _

func (*LSM) GetSkipListFromMemTable

func (lsm *LSM) GetSkipListFromMemTable() *utils.Skiplist

func (*LSM) MemSize

func (lsm *LSM) MemSize() int64

func (*LSM) MemTableIsNil

func (lsm *LSM) MemTableIsNil() bool

func (*LSM) NewIterators

func (lsm *LSM) NewIterators(opt *utils.Options) []utils.Iterator

创建迭代器

func (*LSM) NewMemtable

func (lsm *LSM) NewMemtable() *memTable

NewMemtable _

func (*LSM) Rotate

func (lsm *LSM) Rotate()

func (*LSM) Set

func (lsm *LSM) Set(entry *utils.Entry) (err error)

Set _

func (*LSM) StartCompacter

func (lsm *LSM) StartCompacter()

StartCompacter _

type MergeIterator

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

MergeIterator 多路合并迭代器 NOTE: MergeIterator owns the array of iterators and is responsible for closing them.

func (*MergeIterator) Close

func (mi *MergeIterator) Close() error

Close implements Iterator.

func (*MergeIterator) Item

func (mi *MergeIterator) Item() utils.Item

Key returns the key associated with the current iterator.

func (*MergeIterator) Next

func (mi *MergeIterator) Next()

Next returns the next element. If it is the same as the current key, ignore it.

func (*MergeIterator) Rewind

func (mi *MergeIterator) Rewind()

Rewind seeks to first element (or last element for reverse iterator).

func (*MergeIterator) Seek

func (mi *MergeIterator) Seek(key []byte)

Seek brings us to element with key >= given key.

func (*MergeIterator) Valid

func (mi *MergeIterator) Valid() bool

Valid returns whether the MergeIterator is at a valid element.

type Options

type Options struct {
	WorkDir      string
	MemTableSize int64
	SSTableMaxSz int64
	// BlockSize is the size of each block inside SSTable in bytes.
	BlockSize int
	// BloomFalsePositive is the false positive probabiltiy of bloom filter.
	BloomFalsePositive float64

	// compact
	NumCompactors       int
	BaseLevelSize       int64
	LevelSizeMultiplier int // 决定level之间期望的size比例
	TableSizeMultiplier int
	BaseTableSize       int64
	NumLevelZeroTables  int
	MaxLevelNum         int

	DiscardStatsCh *chan map[uint32]int64
}

Options _

Jump to

Keyboard shortcuts

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