Skip to main content

ozzy_replication/view_change/
error.rs

1//! Why an election event was rejected.
2
3use crate::ReplicationError;
4
5/// Rejected election event. Missing history/quorums wait; conflicts fault.
6#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
7pub enum ViewChangeError {
8    /// Existing journal/normal scope, role, or membership check failed.
9    #[error(transparent)]
10    Replication(#[from] ReplicationError),
11    /// Timers/messages cannot regress or reuse the target view.
12    #[error("view must increase")]
13    ViewNotHigher,
14    /// A restart cannot safely wrap its highest durable view back to zero.
15    #[error("durable view number exhausted")]
16    ViewExhausted,
17    /// All accepted old-view operations must finish synchronization first.
18    #[error("old-view journal work has not settled")]
19    StoragePending,
20    /// Only one metadata promise action can be in flight.
21    #[error("a view promise is already pending")]
22    PromisePending,
23    /// No new metadata write is necessary for this requested view.
24    #[error("requested view already promised")]
25    AlreadyPromised,
26    /// Completion is not the exact outstanding metadata action.
27    #[error("stale or foreign view-promise completion")]
28    StalePromise,
29    /// No election message before successful durable promise completion.
30    #[error("requested view promise has not completed")]
31    PromiseRequired,
32    /// Need own durable promise plus another distinct first-phase voter.
33    #[error("start-view-change quorum missing")]
34    StartQuorumMissing,
35    /// Selection needs the primary's own report and another distinct voter.
36    #[error("do-view-change quorum missing")]
37    ReportQuorumMissing,
38    /// Fetch and validate the frozen selected history before selecting it.
39    #[error("selected lineage evidence missing")]
40    HistoryMissing,
41    /// Malformed positions or last-normal-view cannot become evidence.
42    #[error("invalid frozen view-change report")]
43    InvalidReport,
44    /// A protected prefix or immutable report conflicts with this lineage.
45    #[error("conflicting view-change history")]
46    ConflictingHistory,
47    /// Do not change the selected quorum while installation may be in flight.
48    #[error("view selection already frozen")]
49    SelectionFrozen,
50    /// Primary cannot install without its completed quorum selection.
51    #[error("view has not been selected")]
52    SelectionRequired,
53    /// A replacement writer needs a fresh, globally unique incarnation.
54    #[error("installation reused the old writer generation")]
55    ReusedGeneration,
56    /// Completion does not identify this exact pending installation.
57    #[error("stale or foreign installation completion")]
58    StaleInstallation,
59    /// Successful completion has already transferred ownership to a new role.
60    #[error("installation already completed")]
61    InstallationCompleted,
62    /// Committed canonical state must be rebuilt before role activation.
63    #[error("installed application state is not at the required committed prefix")]
64    ApplicationPending,
65    /// Storage or lineage fault requires recovery, not another local election.
66    #[error("view change faulted")]
67    Faulted,
68}