pub mod auth;
pub mod children;
pub mod cycles;
pub mod directory;
pub mod env;
pub mod index;
pub mod intent;
pub mod log;
pub mod pool;
pub mod registry;
pub mod replay;
pub mod scaling;
#[cfg(feature = "sharding")]
pub mod sharding;
pub mod state;
pub const CANIC_MEMORY_MIN: u8 = 11;
pub const CANIC_MEMORY_MAX: u8 = 99;
pub mod memory {
pub mod topology {
pub const CANISTER_CHILDREN_ID: u8 = 11;
pub const APP_INDEX_ID: u8 = 12;
pub const SUBNET_INDEX_ID: u8 = 13;
pub const APP_REGISTRY_ID: u8 = 14;
pub const SUBNET_REGISTRY_ID: u8 = 15;
}
pub mod env {
pub const ENV_ID: u8 = 16;
pub const SUBNET_STATE_ID: u8 = 17;
}
pub mod auth {
pub const AUTH_STATE_ID: u8 = 19;
pub const ROOT_REPLAY_ID: u8 = 20;
}
pub mod observability {
pub const CYCLE_TRACKER_ID: u8 = 29;
pub const CYCLE_TOPUP_EVENTS_ID: u8 = 30;
pub const LOG_INDEX_ID: u8 = 31;
pub const LOG_DATA_ID: u8 = 32;
}
pub mod intent {
pub const INTENT_META_ID: u8 = 39;
pub const INTENT_RECORDS_ID: u8 = 40;
pub const INTENT_TOTALS_ID: u8 = 41;
pub const INTENT_PENDING_ID: u8 = 42;
}
pub mod pool {
pub const CANISTER_POOL_ID: u8 = 49;
}
pub mod placement {
pub const SCALING_REGISTRY_ID: u8 = 52;
#[cfg(feature = "sharding")]
pub const SHARDING_REGISTRY_ID: u8 = 53;
#[cfg(feature = "sharding")]
pub const SHARDING_ASSIGNMENT_ID: u8 = 54;
pub const DIRECTORY_REGISTRY_ID: u8 = 55;
#[cfg(feature = "sharding")]
pub const SHARDING_ACTIVE_SET_ID: u8 = 56;
}
pub mod state {
pub const APP_STATE_ID: u8 = 62;
}
}
use crate::{InternalError, storage::prelude::*};
use thiserror::Error as ThisError;
#[derive(Debug, ThisError)]
pub enum StableMemoryError {
#[error("log write failed: current_size={current_size}, delta={delta}")]
LogWriteFailed { current_size: u64, delta: u64 },
}
impl From<StableMemoryError> for InternalError {
fn from(err: StableMemoryError) -> Self {
StorageError::StableMemory(err).into()
}
}