ic_memory/ledger/
error.rs1use crate::{key::StableKey, physical::CommitRecoveryError, slot::MemoryManagerSlot};
2
3#[non_exhaustive]
10#[derive(Clone, Debug, Eq, thiserror::Error, PartialEq)]
11pub enum LedgerIntegrityError {
12 #[error("ledger exceeds {resource} limit {limit}")]
14 LimitExceeded {
15 resource: &'static str,
16 limit: usize,
17 },
18 #[error("stable key '{stable_key}' appears in more than one allocation record")]
20 DuplicateStableKey { stable_key: StableKey },
21 #[error("allocation slot '{slot:?}' appears in more than one allocation record")]
23 DuplicateSlot { slot: MemoryManagerSlot },
24 #[error("genesis ledger contains allocation records")]
26 NonemptyGenesis,
27}
28
29#[non_exhaustive]
34#[derive(Clone, Debug, Eq, thiserror::Error, PartialEq)]
35pub enum LedgerCommitError {
36 #[error(transparent)]
38 Recovery(CommitRecoveryError),
39 #[error("allocation ledger codec failed: {0}")]
41 Codec(String),
42 #[error(transparent)]
44 Integrity(LedgerIntegrityError),
45}
46
47#[non_exhaustive]
54#[derive(Clone, Debug, Eq, thiserror::Error, PartialEq)]
55pub enum AllocationStageError {
56 #[error("ledger generation {generation} cannot be advanced without overflow")]
58 GenerationOverflow { generation: u64 },
59 #[error(transparent)]
60 Integrity(#[from] LedgerIntegrityError),
61}