rvm_types/recovery.rs
1//! Recovery and checkpoint types.
2
3use crate::PartitionId;
4
5/// Classification of failure severity.
6#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
7#[repr(u8)]
8pub enum FailureClass {
9 /// Transient: retry is likely to succeed.
10 Transient = 0,
11 /// Recoverable: checkpoint restore can fix.
12 Recoverable = 1,
13 /// Permanent: partition must be destroyed.
14 Permanent = 2,
15 /// Catastrophic: system-wide recovery needed.
16 Catastrophic = 3,
17}
18
19/// A recovery checkpoint (state snapshot).
20#[derive(Debug, Clone, Copy)]
21pub struct RecoveryCheckpoint {
22 /// Partition this checkpoint belongs to.
23 pub partition: PartitionId,
24 /// Sequence number of the witness record at checkpoint time.
25 pub witness_sequence: u64,
26 /// Timestamp when the checkpoint was taken.
27 pub timestamp_ns: u64,
28 /// Epoch at checkpoint time.
29 pub epoch: u32,
30}
31
32/// A receipt for reconstructing a hibernated partition.
33#[derive(Debug, Clone, Copy)]
34pub struct ReconstructionReceipt {
35 /// Original partition ID.
36 pub original_id: PartitionId,
37 /// Checkpoint from which to reconstruct.
38 pub checkpoint: RecoveryCheckpoint,
39 /// Whether the partition was hibernated (vs destroyed).
40 pub was_hibernated: bool,
41}