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
//! The observer-recovery aggregate's refusals, moved out of `observer_recovery.rs` unchanged so
//! that file stays within the 500-line bound.
use crate::wire::{ConversationId, DeliverySeq, ObserverEpoch};
/// Restore-time validation failure for the owned observer-recovery aggregate.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ObserverRecoveryAggregateRestoreError {
/// One conversation appears twice in the durable progress rows.
DuplicateProgress {
/// Duplicated conversation.
conversation_id: ConversationId,
},
/// One conversation appears twice in the durable arm rows.
DuplicateArm {
/// Duplicated conversation.
conversation_id: ConversationId,
},
/// A durable arm names a conversation with no durable progress row.
ArmWithoutProgress {
/// Conversation named by the orphaned arm.
conversation_id: ConversationId,
},
/// A durable arm's epoch differs from its conversation's progress.
///
/// An installed arm is always equal-epoch: it is installed at the exact
/// read progress and fired (removed) by the same mutation that advances
/// progress past it, so any durable disagreement is corruption.
ArmEpochMismatch {
/// Conversation whose arm disagrees.
conversation_id: ConversationId,
/// Epoch stored with the arm.
armed_epoch: ObserverEpoch,
/// Durable hard observer progress.
current_observer_progress: DeliverySeq,
},
}
/// Failure while registering a newly tracked conversation.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ObserverProgressTrackError {
/// The conversation already has an authoritative progress row.
AlreadyTracked {
/// Conversation presented twice.
conversation_id: ConversationId,
},
}
/// Failure while advancing hard observer progress.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ObserverProgressAdvanceError {
/// The conversation has no authoritative progress row.
ConversationUnknown {
/// Unknown conversation.
conversation_id: ConversationId,
},
/// The presented progress does not strictly advance the current value.
NotAdvancing {
/// Conversation whose progress was presented.
conversation_id: ConversationId,
/// Current hard observer progress.
current_observer_progress: DeliverySeq,
/// Non-advancing presented progress.
presented_progress: DeliverySeq,
},
}