1use crate::{LostKey, RowId, WriteId};
2
3#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)]
5pub enum MergeError {
6 #[error("milliseconds exceed 48 bits: {0}")]
8 MillisecondsOutOfRange(u64),
9 #[error("timestamp space exhausted")]
11 TimestampExhausted,
12 #[error("generation space exhausted")]
14 GenerationExhausted,
15 #[error("operation has the wrong generation parity: {0}")]
17 GenerationParity(u64),
18 #[error("generation {generation} of {row:?} was not read by the author")]
20 GenerationNotSeen {
21 row: RowId,
23 generation: u64,
25 },
26 #[error("change to {row:?} is ahead of the receiving generation")]
28 GenerationAhead {
29 row: RowId,
31 },
32 #[error("write {0:?} has not been applied")]
34 MissingWrite(WriteId),
35 #[error("write {0:?} occurs twice")]
37 DuplicateWrite(WriteId),
38 #[error("writes {0:?} and {1:?} have equal timestamps")]
40 DuplicateTimestamp(WriteId, WriteId),
41 #[error("write {0:?} is not stamped after its past")]
43 CausalTimestamp(WriteId),
44 #[error("write {0:?} has a past that is not causally closed")]
47 CausalClosure(WriteId),
48 #[error("timestamp device differs from write {0:?}")]
50 TimestampDevice(WriteId),
51 #[error("write has no change for {0:?}")]
53 MissingChange(RowId),
54 #[error("parent generation is not odd: {0}")]
56 ParentGeneration(u64),
57 #[error("reference from {0:?} reaches an unreadable audience")]
59 ReferenceAudience(RowId),
60 #[error("removal view lists {0:?} twice")]
62 #[cfg(any(test, feature = "test-utils"))]
63 DuplicateRow(RowId),
64 #[error("stored generation {0} is missing or out of order")]
66 GenerationGap(u64),
67 #[error("stored generation {0} is not stamped after its predecessor")]
69 GenerationTimestamp(u64),
70 #[error("deleted row has winning cells")]
72 DeletedRowHasCells,
73 #[error("cell {0} precedes its incarnation")]
75 CellBeforeIncarnation(String),
76 #[error("invalid lost value {0:?}")]
78 InvalidLostValue(LostKey),
79 #[error("unique constraint column {0} has no winning value")]
81 #[cfg(test)]
82 MissingClaimColumn(String),
83 #[error("unique constraint has no columns")]
85 #[cfg(test)]
86 EmptyClaim,
87}