1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/// Transaction checkpoints where tests can inject failures or simulate
/// process death. Every checkpoint fires *after* the named step completed.
#[allow(clippy::enum_variant_names)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum TxPoint {
/// After configuration validation.
AfterValidate,
/// After the backend resolved the target resource.
AfterResolve,
/// After the exclusive resource lock was acquired.
AfterLock,
/// After any stale journal for the resource was inspected and recovered.
AfterRecovery,
/// After the current state was captured.
AfterCapture,
/// After the semantic no-op decision.
AfterNoopDecision,
/// After the `Prepared` journal record was persisted.
AfterPrepared,
/// After the OS mutation returned.
AfterApply,
/// After the post-mutation read-back.
AfterReadback,
/// After verification of the read-back state.
AfterVerify,
/// After the `Applied` journal record was persisted.
AfterApplied,
/// After scope-consistency was checked on lease update.
AfterUpdateResolve,
/// After the current state was read on lease update.
AfterUpdateCapture,
/// After the no-op decision on lease update.
AfterUpdateNoopCheck,
/// After the updated `Prepared` journal record was persisted.
AfterUpdatePrepared,
/// After the OS mutation returned during lease update.
AfterUpdateApply,
/// After the post-mutation read-back during lease update.
AfterUpdateReadback,
/// After verification during lease update.
AfterUpdateVerify,
/// After the `Applied` journal record was persisted during lease update.
AfterUpdateApplied,
/// After the current state was read at the start of restore.
AfterRestoreReadback,
/// After the backend restored the original snapshot.
AfterRestoreRestore,
/// After the journal record was removed at the end of restore.
AfterRestoreJournal,
/// After the current state was read at the start of journal recovery.
AfterRecoveryReadback,
/// After the recovery restore of the original snapshot.
AfterRecoveryRestore,
/// After the journal record was removed at the end of recovery.
AfterRecoveryJournal,
}
#[allow(dead_code)]
pub(crate) enum FaultAction {
Continue,
Crash,
Fail(String),
}
pub(crate) trait FaultHook: Send + Sync {
fn on_point(&self, point: TxPoint) -> FaultAction;
}
/// Panic payload used to simulate abrupt process death mid-transaction.
#[derive(Debug)]
pub(crate) struct CrashSignal;