Skip to main content

ic_memory/
lib.rs

1//! Persistent allocation-governance primitives for Internet Computer stable
2//! memory.
3//!
4//! The crate models durable ownership as `stable_key -> allocation_slot
5//! forever`. It intentionally does not own framework namespaces, controller
6//! authorization, endpoint lifecycle, schema migrations, or Canic-specific
7//! memory ID policy.
8
9pub mod bootstrap;
10pub mod declaration;
11pub mod diagnostics;
12pub mod generation;
13pub mod key;
14pub mod ledger;
15pub mod physical;
16pub mod policy;
17pub mod schema;
18pub mod session;
19pub mod slot;
20pub mod substrate;
21pub mod validation;
22
23pub use bootstrap::{
24    AllocationBootstrap, BootstrapCommit, BootstrapError, BootstrapReservationError,
25    BootstrapRetirementError,
26};
27pub use declaration::{
28    AllocationDeclaration, DeclarationCollector, DeclarationSnapshot, DeclarationSnapshotError,
29};
30pub use diagnostics::{DiagnosticExport, DiagnosticGeneration, DiagnosticRecord};
31pub use generation::{GenerationCommit, GenerationMutation, StagedGeneration};
32pub use key::{StableKey, StableKeyError};
33pub use ledger::{
34    AllocationHistory, AllocationLedger, AllocationRecord, AllocationReservationError,
35    AllocationRetirement, AllocationRetirementError, AllocationState,
36    CURRENT_LEDGER_SCHEMA_VERSION, CURRENT_PHYSICAL_FORMAT_ID, GenerationRecord, LedgerCodec,
37    LedgerCommitError, LedgerCommitStore, LedgerCompatibility, LedgerCompatibilityError,
38    LedgerIntegrityError, SchemaMetadataRecord,
39};
40pub use physical::{
41    AuthoritativeSlot, CommitRecoveryError, CommitSlotDiagnostic, CommitSlotIndex,
42    CommitStoreDiagnostic, CommittedGenerationBytes, DualCommitStore, ProtectedGenerationSlot,
43    select_authoritative_slot,
44};
45pub use policy::{AllocationPolicy, NamespaceAuthority, RangeAuthority};
46pub use schema::{SchemaMetadata, SchemaMetadataError};
47pub use session::{AllocationSession, AllocationSessionError, ValidatedAllocations};
48pub use slot::{
49    AllocationSlot, AllocationSlotDescriptor, MEMORY_MANAGER_DESCRIPTOR_VERSION,
50    MEMORY_MANAGER_INVALID_ID, MEMORY_MANAGER_MAX_ID, MEMORY_MANAGER_MIN_ID,
51    MEMORY_MANAGER_SUBSTRATE, MemoryManagerIdRange, MemoryManagerRangeError,
52    MemoryManagerSlotError, validate_memory_manager_id,
53};
54pub use substrate::{LedgerAnchor, StorageSubstrate};
55pub use validation::{AllocationValidationError, validate_allocations};