Skip to main content

Module twcs

Module twcs 

Source

Structsยง

Candidate ๐Ÿ”’
Metrics of a candidate compaction input, accumulated incrementally as the candidate interval expands 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.
InactiveWindowPick ๐Ÿ”’
Picks compaction inputs for an inactive window.
OrderedFile ๐Ÿ”’
TwcsPicker
TwcsPicker picks files of which the max timestamp are in the same time window as compaction candidates.
Window ๐Ÿ”’
WindowOutputContext ๐Ÿ”’
WindowPickContext ๐Ÿ”’

Enumsยง

PickPhase ๐Ÿ”’

Constantsยง

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.
PICK_PHASES ๐Ÿ”’

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 or all files are corrupted.
is_balanced_candidate ๐Ÿ”’
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_window_files ๐Ÿ”’
pick_l1_candidate_files ๐Ÿ”’
pick_l1_file_reduction ๐Ÿ”’
pick_l1_overlap_only ๐Ÿ”’
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 ๐Ÿ”’
window_has_overlap ๐Ÿ”’

Type Aliasesยง

CandidatePicker ๐Ÿ”’