use crate::control::types::{Generation, Lane, RendezvousId, SessionId};
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum CapError {
UnknownToken,
WrongSessionOrLane,
Exhausted,
TableFull,
Mismatch,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) struct GenerationRecord {
pub lane: Lane,
pub last: Generation,
pub new: Generation,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum GenError {
StaleOrDuplicate(GenerationRecord),
Overflow { lane: Lane, last: Generation },
InvalidInitial { lane: Lane, new: Generation },
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RendezvousError {
LaneOutOfRange { lane: Lane },
LaneBusy { lane: Lane },
SessionAlreadyRegistered { sid: SessionId, lane: Lane },
SessionPoisoned { sid: SessionId },
ClusterError(crate::control::cluster::error::CpError),
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TopologyError {
LaneOutOfRange { lane: Lane },
UnknownSession { sid: SessionId },
LaneMismatch { expected: Lane, provided: Lane },
InProgress { lane: Lane },
NoPending { lane: Lane },
StaleGeneration {
lane: Lane,
last: Generation,
new: Generation,
},
GenerationOverflow { lane: Lane, last: Generation },
InvalidInitial { lane: Lane, new: Generation },
RemoteRendezvousMismatch {
expected: RendezvousId,
got: RendezvousId,
},
RendezvousIdMismatch {
expected: RendezvousId,
got: RendezvousId,
},
SeqnoMismatch { seq_tx: u32, seq_rx: u32 },
PendingTableFull,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum StateRestoreError {
NoStateSnapshot { sid: SessionId },
StaleStateSnapshot {
sid: SessionId,
requested: Generation,
current: Generation,
},
AlreadyFinalized { sid: SessionId },
EpochMismatch {
expected: Generation,
got: Generation,
},
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum TxCommitError {
NoStateSnapshot { sid: SessionId },
AlreadyFinalized { sid: SessionId },
GenerationMismatch {
sid: SessionId,
expected: Generation,
got: Generation,
},
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum TxAbortError {
NoStateSnapshot { sid: SessionId },
StaleStateSnapshot {
sid: SessionId,
requested: Generation,
current: Generation,
},
AlreadyFinalized { sid: SessionId },
GenerationMismatch {
sid: SessionId,
expected: Generation,
got: Generation,
},
}