Expand description
Thread-safe filesystem test hooks.
§Design Architecture & Invariants
-
Hooks<'a>&HooksHandle:Hooks<'a>is the exclusive mutator handle bound to lifetime'a(the test context).HooksHandleis shared viaArcbyFxFilesystemoptions to invoke registered test callbacks (on_*methods) during transaction commits. -
Lifetime Safety: Incoming hook closures bound to lifetime
'aare transmuted to'staticand stored insideHooksInner.Hooks<'a>holds the primaryArc<HooksInner>, whileHooksHandleholds aWeak<HooksInner>. -
Cleanup & Synchronization: When
Hooks<'a>drops, it drops itsArc<HooksInner>and waits for a message on anmpscchannel. Active readers (on_*methods) temporarily upgrade theWeakreference to anArc, ensuringHooksInnerremains valid during callback execution. When all readers finish andHooksInnerdrops,SendOnDrop(the last field ofHooksInner) drops afterHooksTable, sending the completion signal todetach().
Structs§
- Hooks
- Used to register test hooks for an
FxFilesystem. - Hooks
Handle - Handle stored on
FxFilesystemoptions to trigger registered test hooks.