Skip to main content

sweep_expired_captures

Function sweep_expired_captures 

Source
pub fn sweep_expired_captures(dir: &Path) -> u64
Expand description

Delete any expired capture bundles in dir (bounded retention sweep).

Expiry is logical (an expired bundle can never be exported — see export_content); this sweep is the physical deletion invoked on every trace interaction (new captures, exports, /trace status, CLI trace subcommands) AND operationally at Runtime/session startup and in both the sync and async shutdown epilogues — stale bundles do not wait for the next explicit trace interaction.

Hardening: each entry is examined through the bounded regular-file primitive — symlinks are never followed, FIFOs never block, directories and devices are never read, and oversized or malformed files are removed without unbounded reads. Work is bounded ([MAX_SWEEP_ENTRIES]) and confined to direct entries of dir; every failure is soft.