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 manager;
9mod policy;
10pub mod registry;
11pub mod runtime;
12
13pub use crate::{eager_init, eager_static, ic_memory_key, ic_memory_range};
14
15/// Stable allocation-policy authority for Canic core memory declarations.
16pub const CANIC_CORE_MEMORY_AUTHORITY: &str = "canic-core";
17/// Stable allocation-policy authority for Canic control-plane memory declarations.
18pub const CANIC_CONTROL_PLANE_MEMORY_AUTHORITY: &str = "canic-control-plane";
19
20pub(crate) fn bootstrap_default_memory_manager()
21-> Result<(), ic_memory::RuntimeBootstrapError<registry::MemoryRegistryError>> {
22    ic_memory::bootstrap_default_memory_manager_with_policy(&policy::CanicMemoryManagerPolicy::new())
23        .map(|_| ())
24}