Documentation
¶
Index ¶
- type Candidate
- type Compactor
- func (c *Compactor) Candidates(opts Options) ([]Candidate, error)
- func (c *Compactor) CompactCandidates(opts Options) error
- func (c *Compactor) CompactCandidatesWithContext(ctx context.Context, opts Options) error
- func (c *Compactor) CompactSlab(id uint32) error
- func (c *Compactor) CompactSlabWithContext(ctx context.Context, id uint32, opts Options) error
- func (c *Compactor) CompactSlabWithOptions(id uint32, opts Options) error
- type Options
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compactor ¶
type Compactor struct {
// contains filtered or unexported fields
}
func (*Compactor) CompactCandidates ¶
func (*Compactor) CompactCandidatesWithContext ¶
func (*Compactor) CompactSlab ¶
CompactSlab performs compaction on a specific slab file. It rewrites live records to a new slab and updates pointers in micro-batches.
func (*Compactor) CompactSlabWithContext ¶
CompactSlabWithContext compacts a slab using the provided options and context. If ctx is canceled, compaction aborts promptly and returns ctx.Err().
type Options ¶
type Options struct {
DeadRatioThreshold float64
MinTotalBytes uint64
MaxSlabs int
MicroBatchSize int
// IndexSwap rebuilds the index into a new file and swaps it in once after
// compacting one or more slabs. This avoids high write amplification from
// applying many pointer updates via COW B-Tree commits.
IndexSwap bool
// LiveSetMaxEntries controls the in-memory live pointer set size used to
// skip per-record tree lookups during compaction. 0 uses a default; <0
// disables the live-set optimization.
LiveSetMaxEntries int
// Assist is an optional hook invoked periodically during compaction work.
// It must be fast and must not assume any compaction locks are held.
// Typical use: coordinate with caching-layer backpressure by triggering a
// bounded flush when backlog grows.
Assist func()
// Stats is an optional collector for compaction counters.
Stats *Stats
// RotateBeforeWrite forces a slab rotation once before moving any records.
// This can reduce interference with the current active slab, but will create
// a new slab file even if compaction ends up being a no-op.
RotateBeforeWrite bool
// CopyBytesPerSec limits compaction copy IO. 0 disables throttling.
CopyBytesPerSec int64
// CopyBurstBytes is the limiter burst size. 0 uses a 1-second burst.
CopyBurstBytes int64
}
Click to show internal directories.
Click to hide internal directories.