pub struct MemoryRegistry;Expand description
MemoryRegistry
Canonical substrate registry for stable memory IDs.
Implementations§
Source§impl MemoryRegistry
impl MemoryRegistry
Sourcepub fn reserve_range(
crate_name: &str,
start: u8,
end: u8,
) -> Result<(), MemoryRegistryError>
pub fn reserve_range( crate_name: &str, start: u8, end: u8, ) -> Result<(), MemoryRegistryError>
Reserve an inclusive memory ID range for one crate.
Exact duplicate reservations by the same crate are accepted so init and post-upgrade can share the same bootstrap path.
Sourcepub fn register(
id: u8,
crate_name: &str,
label: &str,
) -> Result<(), MemoryRegistryError>
pub fn register( id: u8, crate_name: &str, label: &str, ) -> Result<(), MemoryRegistryError>
Register one memory ID under an existing owner range.
Sourcepub fn register_with_key(
id: u8,
crate_name: &str,
label: &str,
stable_key: &str,
) -> Result<(), MemoryRegistryError>
pub fn register_with_key( id: u8, crate_name: &str, label: &str, stable_key: &str, ) -> Result<(), MemoryRegistryError>
Register one memory ID under an existing owner range using an explicit ABI key.
Sourcepub fn export() -> Vec<(u8, MemoryRegistryEntry)>
pub fn export() -> Vec<(u8, MemoryRegistryEntry)>
Export all registered entries (canonical snapshot).
Sourcepub fn export_ranges() -> Vec<(String, MemoryRange)>
pub fn export_ranges() -> Vec<(String, MemoryRange)>
Export all reserved ranges.
Sourcepub fn export_range_entries() -> Vec<MemoryRangeEntry>
pub fn export_range_entries() -> Vec<MemoryRangeEntry>
Export all reserved ranges with explicit owners.
Sourcepub fn export_ids_by_range() -> Vec<MemoryRangeSnapshot>
pub fn export_ids_by_range() -> Vec<MemoryRangeSnapshot>
Export registry entries grouped by reserved range.
Sourcepub fn get(id: u8) -> Option<MemoryRegistryEntry>
pub fn get(id: u8) -> Option<MemoryRegistryEntry>
Retrieve a single registry entry.
Sourcepub fn export_historical_ranges() -> Vec<(String, MemoryRange)>
pub fn export_historical_ranges() -> Vec<(String, MemoryRange)>
Export all ranges ever recorded in the stable memory layout ledger.
Sourcepub fn try_export_historical_ranges() -> Result<Vec<(String, MemoryRange)>, MemoryRegistryError>
pub fn try_export_historical_ranges() -> Result<Vec<(String, MemoryRange)>, MemoryRegistryError>
Fallibly export all ranges ever recorded in the stable memory layout ledger.
Sourcepub fn export_historical() -> Vec<(u8, MemoryRegistryEntry)>
pub fn export_historical() -> Vec<(u8, MemoryRegistryEntry)>
Export all memory IDs ever recorded in the stable memory layout ledger.
Sourcepub fn try_export_historical() -> Result<Vec<(u8, MemoryRegistryEntry)>, MemoryRegistryError>
pub fn try_export_historical() -> Result<Vec<(u8, MemoryRegistryEntry)>, MemoryRegistryError>
Fallibly export all memory IDs ever recorded in the stable memory layout ledger.