pub mod auth;
pub mod children;
pub mod cycles;
pub mod directory;
pub mod env;
pub mod intent;
pub mod log;
pub mod pool;
pub mod registry;
pub mod replay;
pub mod scaling;
pub mod sharding;
pub mod state;
pub const CANIC_MEMORY_MIN: u8 = 13;
pub const CANIC_MEMORY_MAX: u8 = 59;
const _: () = {
#[canic_memory::__reexports::ctor::ctor(
anonymous,
crate_path = canic_memory::__reexports::ctor
)]
fn __canic_reserve_topology_memory_range() {
canic_memory::ic_memory_range!(5, 9);
}
};
pub mod memory {
pub mod topology {
pub const CANISTER_CHILDREN_ID: u8 = 5;
pub const APP_DIRECTORY_ID: u8 = 6;
pub const SUBNET_DIRECTORY_ID: u8 = 7;
pub const APP_REGISTRY_ID: u8 = 8;
pub const SUBNET_REGISTRY_ID: u8 = 9;
}
pub mod env {
pub const ENV_ID: u8 = 13;
pub const SUBNET_STATE_ID: u8 = 14;
}
pub mod auth {
pub const DELEGATION_STATE_ID: u8 = 16;
pub const ROOT_REPLAY_ID: u8 = 17;
}
pub mod observability {
pub const CYCLE_TRACKER_ID: u8 = 26;
pub const LOG_INDEX_ID: u8 = 27;
pub const LOG_DATA_ID: u8 = 28;
}
pub mod intent {
pub const INTENT_META_ID: u8 = 36;
pub const INTENT_RECORDS_ID: u8 = 37;
pub const INTENT_TOTALS_ID: u8 = 38;
pub const INTENT_PENDING_ID: u8 = 39;
}
pub mod pool {
pub const CANISTER_POOL_ID: u8 = 46;
}
pub mod placement {
pub const SCALING_REGISTRY_ID: u8 = 49;
pub const SHARDING_REGISTRY_ID: u8 = 50;
pub const SHARDING_ASSIGNMENT_ID: u8 = 51;
pub const SHARDING_ACTIVE_SET_ID: u8 = 53;
}
pub mod state {
pub const APP_STATE_ID: u8 = 59;
}
}
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()
}
}