compaction

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompactionPlan added in v1.1.0

type CompactionPlan struct {
	IsTrivialMove bool                   // True if we can just move a single L0 file to L1
	Level         int                    // Level to compact from
	TargetLevel   int                    // Level to compact to
	Inputs        []manifest.SegmentInfo // Segments to compact
	Overlaps      []manifest.SegmentInfo // Overlapping segments in target level
	Reason        string
}

CompactionPlan describes a compaction task.

type Compactor

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

Compactor manages LSM compaction.

func NewCompactor

func NewCompactor(dir string, m *manifest.Manifest, logger common.Logger, alloc func() uint64) *Compactor

NewCompactor creates a new compactor.

func (*Compactor) Execute added in v1.1.0

func (c *Compactor) Execute(plan *CompactionPlan) ([]*segment.Reader, error)

Execute runs a compaction job described by the plan. It returns the list of new segment readers and an error if any.

func (*Compactor) Plan added in v1.1.0

func (c *Compactor) Plan() *CompactionPlan

Plan decides if a compaction is needed and returns a plan. If no compaction is needed, it returns nil.

func (*Compactor) SetBuilderConfigurator added in v1.1.0

func (c *Compactor) SetBuilderConfigurator(fn func(*segment.Builder))

SetBuilderConfigurator sets a callback that configures each new segment.Builder the compactor creates.

func (*Compactor) Start

func (c *Compactor) Start(ctx context.Context)

Start starts the compaction background process.

func (*Compactor) Stop

func (c *Compactor) Stop()

Stop stops the compaction process.

func (*Compactor) TriggerCompaction

func (c *Compactor) TriggerCompaction()

TriggerCompaction manually triggers compaction.

Jump to

Keyboard shortcuts

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