Skip to main content

Module gc

Module gc 

Source
Expand description

gc: the shared startup sweep, then the pair-record collector with the dead-seen grace (spec “Pairing contract”, gc).

Every decision and every path keys on the id in the FILE NAME (pair.<id>.json), validated first: pairing::read_record and list_records key on it too, and this module deletes files. gc never opens a log: the caller (the gc subcommand, or pair with its own log) owns that.

Structs§

GcReport

Enums§

Verdict 🔒
What the two sides add up to.

Constants§

DEAD_SEEN_GRACE_MS
A pair is collected only when its dead-seen is strictly older than this.
UNKNOWN_GRACE_MS
A side unknown for strictly more than this counts as dead.

Functions§

active_sessions 🔒
session.active read once: the set of active session ids, or None when it cannot be read.
delete_pair 🔒
Delete every file of the pair, the record last. Nothing is deleted when any entry is not a regular file.
gc
The sweep, then the record loop (skipped when session.active cannot be read). before_delete is the test failpoint, called after the grace has elapsed and before the liveness is re-read for the deletion decision; every real caller passes None.
load_record 🔒
The record behind pair.<id>.json, keyed on the file name: a regular file (never a symlink) that parses (read_record keys it on the file name’s id).
mtime_ms 🔒
pair_file 🔒
pair_files_deletable 🔒
Every pair.<id>.* entry must be a regular file directly in the home (no symlink, no directory).
read_dead_seen 🔒
dead-seen content as <epoch ms>; absent or unparsable is None.
remove_dead_seen 🔒
tui_pid_file 🔒
The pid sentinel that produced an unknown TUI reading: the record’s generation when it has a tui-pid, else the highest generation that has one (the rule side_liveness applies).
unknown_age_ms 🔒
Age of an unknown side: the mtime of its sentinel, else the record’s created.
verdict 🔒
write_dead_seen 🔒