Skip to main content

riffdb_errors/
replication.rs

1//! Shared payload-free replication refusals across service and storage boundaries.
2
3/// Closed, payload-free replication negotiation or stream refusal.
4#[derive(Clone, Copy, Debug, Eq, PartialEq)]
5pub enum ReplicationStreamErrorV3 {
6    /// The database or history incarnation differs from the durable pin.
7    ForeignLineage,
8    /// The leadership epoch differs from the durable pin.
9    StaleEpoch,
10    /// Retention has removed the requested successor history.
11    HistoryPruned,
12    /// The peer cannot read the production V3 format.
13    UnsupportedFormat,
14    /// The peer names a different authoritative inventory.
15    UnsupportedCatalog,
16    /// The peer cannot honor the exact production frame ceilings.
17    UnsupportedBounds,
18    /// The requested position, hash, or frontier does not match retained history.
19    InvalidPosition,
20    /// A source violated exact receipt continuity or its pinned end.
21    CorruptHistory,
22    /// The published source could not be read.
23    Unavailable,
24}
25
26impl std::fmt::Display for ReplicationStreamErrorV3 {
27    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28        f.write_str(match self {
29            Self::ForeignLineage => "foreign replication lineage",
30            Self::StaleEpoch => "stale replication epoch",
31            Self::HistoryPruned => "replication history has been pruned",
32            Self::UnsupportedFormat => "unsupported replication format",
33            Self::UnsupportedCatalog => "unsupported replication catalog",
34            Self::UnsupportedBounds => "unsupported replication bounds",
35            Self::InvalidPosition => "invalid replication resume position",
36            Self::CorruptHistory => "invalid replication history",
37            Self::Unavailable => "replication source is unavailable",
38        })
39    }
40}
41
42impl std::error::Error for ReplicationStreamErrorV3 {}