Skip to main content

Module twcs

Module twcs 

Source

ModulesΒ§

units πŸ”’
Unit-based compaction picks for one TWCS window.

StructsΒ§

Candidate πŸ”’
Metrics of a candidate compaction input, accumulated one file at a time.
CandidateScore πŸ”’
Score of a candidate compaction input. Higher is better: first by the predicted net file count reduction, then by the number of files participating in an overlap, then by smaller input bytes.
OrderedFile πŸ”’
TwcsCandidates πŸ”’
Discovery snapshot retained until the scheduler chooses its alternatives. Only selected candidates incur tombstone checks and pick-result logging.
TwcsPickMetrics πŸ”’
Cloneable planning metric handles, shared with spawned window evaluations.
TwcsPicker
TwcsPicker picks files of which the max timestamp are in the same time window as compaction candidates.
Window πŸ”’
WindowCandidate πŸ”’
A discovered alternative, not yet selected or admitted by the scheduler.
WindowOutputContext πŸ”’
WindowPick πŸ”’
Compaction inputs picked for one window.
WindowPickContext πŸ”’
Snapshot-wide inputs shared by each independent window strategy.

EnumsΒ§

PickClass πŸ”’
Scheduling priority of a window’s pick. Earlier classes are scheduled first, and newer windows first within a class.

ConstantsΒ§

CLOSED_MERGE_INPUT_FACTOR πŸ”’
A closed merge in an inactive window may take this many times MAX_INPUT_FILES. Resolving overlaps across a whole window needs all of its overlapping files at once, and each byte is rewritten once per window.
DEFAULT_MAX_INPUT_FILES πŸ”’
Default maximum number of input SST files in one compaction input.
LEVEL_COMPACTED πŸ”’
MAX_INPUT_FILES_ENV πŸ”’
MAX_L1_L0_ROW_RATIO πŸ”’
A mixed L0/L1 compaction may rewrite at most this many L1 rows per L0 row.

StaticsΒ§

MAX_INPUT_FILES πŸ”’
Maximum number of input SST files in one compaction input. Configurable via MAX_INPUT_FILES_ENV.

FunctionsΒ§

assign_to_windows πŸ”’
Assigns files to windows with predefined window size (in seconds) by their max timestamps.
find_active_window_by_sequence πŸ”’
Finds the active window from the file with the highest sequence number.
find_latest_window_in_seconds πŸ”’
Finds the latest active writing window among all files. Returns None when there are no files.
is_balanced_candidate πŸ”’
is_quiet_window πŸ”’
Whether the region has written at least as many rows as files hold, and at least one row, since the newest of them was written. Sequences are assigned per row and compaction keeps the inputs’ maximum, so this needs no state. Files written before row counts were recorded have zero rows, so a window holding them is not quiet.
is_settling_window πŸ”’
Whether window is the one right before active_window, where late data still lands.
log_pick_result πŸ”’
ordered_files πŸ”’
Flattens sorted runs into files ordered by (start asc, end desc), breaking ties by run and position to keep the order deterministic.
parse_max_input_files πŸ”’
pick_candidate_files πŸ”’
pick_count_first πŸ”’
Picks a contiguous (in global time order) interval of files to compact.
pick_count_first_where πŸ”’
pick_inactive_l0 πŸ”’
Absorbs L0 files of an inactive window, in order of preference:
pick_mixed_within_budget πŸ”’
Mixed-level fallback for inactive windows: bypasses the balance checks but bounds the total rewrite to the output file budget.
pick_unbalanced_count_first πŸ”’
Last-resort pick for inactive windows with no balance requirement at all. Callers must only pass single-level (L0) files so the rewrite stays bounded by their bytes.
selected_overlaps_unselected πŸ”’
time_window_intersects_range πŸ”’
time_window_start πŸ”’
Uses the same half-open windows as memtables, including timestamps in the first second after a boundary. An unrepresentable window start is clamped to i64::MIN.
window_has_overlap πŸ”’

Type AliasesΒ§

CandidatePicker πŸ”’