Skip to main content

canic_core/memory/
mod.rs

1//! Module: memory
2//!
3//! Responsibility: adapt Canic stable-memory declarations to `ic-memory` bootstrap.
4//! Does not own: stable data schemas, ops storage APIs, or lifecycle orchestration.
5//! Boundary: lifecycle initializes this before stable structures are accessed.
6
7pub(crate) mod ledger;
8mod policy;
9pub mod registry;
10pub mod runtime;
11
12pub use crate::{eager_init, eager_static, ic_memory_key, ic_memory_range};
13
14/// Stable allocation-policy authority for Canic core memory declarations.
15pub const CANIC_CORE_MEMORY_AUTHORITY: &str = "canic-core";
16/// Stable allocation-policy authority for Canic control-plane memory declarations.
17pub const CANIC_CONTROL_PLANE_MEMORY_AUTHORITY: &str = "canic-control-plane";
18
19pub(crate) fn bootstrap_default_memory_manager()
20-> Result<(), ic_memory::RuntimeBootstrapError<registry::MemoryRegistryError>> {
21    ic_memory::bootstrap_default_memory_manager_with_policy(&policy::CanicMemoryManagerPolicy::new())
22        .map(|_| ())
23}