compaction

package
v0.0.0-...-e9c076f Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = &Options{
	LevelMultiplier:      10,
	MaxLevels:            4,
	MaxBytesForLevelBase: 128 * (1 << 20),
	L0MaxFiles:           2,
	BaseLevel:            1,
}
View Source
var (
	ErrEmptyIters = errors.New("provided empty slice of iterators")
)

Functions

This section is empty.

Types

type CompactionReq

type CompactionReq struct {
	L0     *sst.Level
	Levels []*sst.Level
	Logger *log.Logger

	EstimatedSize  uint64 // todo
	IsL0Compaction bool
	SourceLevel    *sst.Level
	SourceTables   []*sst.SST
	TargetLevel    *sst.Level
	TargetTables   []*sst.SST
	Lower, Upper   common.Iterator
	// contains filtered or unexported fields
}

func (*CompactionReq) Json

func (cr *CompactionReq) Json() []byte

type HeapIter

type HeapIter []common.Iterator

HeapIter 0 min heap to maintain sst property, keys can be overlapping

func (HeapIter) Len

func (h HeapIter) Len() int

func (HeapIter) Less

func (h HeapIter) Less(i, j int) bool

func (*HeapIter) Pop

func (h *HeapIter) Pop() any

func (*HeapIter) Push

func (h *HeapIter) Push(x any)

func (HeapIter) Swap

func (h HeapIter) Swap(i, j int)

type LeveledCompaction

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

func NewLeveledCompaction

func NewLeveledCompaction(opt *Options) *LeveledCompaction

func (*LeveledCompaction) MaybeTriggerCompaction

func (l *LeveledCompaction) MaybeTriggerCompaction(req *CompactionReq) (*CompactionReq, error)

type MergeIter

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

MergeIter has keys from underlying iterators that can be overlapping, so we must always pick the smallest one

func NewMergeIter

func NewMergeIter(iters ...common.Iterator) (*MergeIter, error)

NewMergeIter creates a new MergeIter from given iterators.

func (*MergeIter) Key

func (mi *MergeIter) Key() ikey

func (*MergeIter) Next

func (mi *MergeIter) Next() (ikey, []byte, error)

func (*MergeIter) SeekToFirst

func (mi *MergeIter) SeekToFirst() (*common.InternalKey, []byte, error)

func (*MergeIter) Valid

func (mi *MergeIter) Valid() bool

func (*MergeIter) Value

func (mi *MergeIter) Value() []byte

type Options

type Options struct {
	LevelMultiplier      int
	MaxBytesForLevelBase int
	MaxLevels            uint8
	L0MaxFiles           int
	BaseLevel            int
}

type TwoLevelIter

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

TwoLevelIter iterates over two common.Iterator and choses smaller key from each iteration resulting in sorted strings table

func NewTwoLevelIter

func NewTwoLevelIter(i1, i2 common.Iterator) (*TwoLevelIter, error)

func (*TwoLevelIter) Key

func (mi *TwoLevelIter) Key() *common.InternalKey

func (*TwoLevelIter) Next

func (mi *TwoLevelIter) Next() (*common.InternalKey, []byte, error)

func (*TwoLevelIter) SeekToFirst

func (mi *TwoLevelIter) SeekToFirst() (*common.InternalKey, []byte, error)

func (*TwoLevelIter) Valid

func (mi *TwoLevelIter) Valid() bool

func (*TwoLevelIter) Value

func (mi *TwoLevelIter) Value() []byte

Jump to

Keyboard shortcuts

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