MCPcopy Create free account
hub / github.com/dfinity/orbit / save_memory_snapshot

Function save_memory_snapshot

core/station/impl/src/migration_tests/mod.rs:31–44  ·  view source on GitHub ↗
(label: &str, memory_id: MemoryId)

Source from the content-addressed store, hash-verified

29 };
30
31 fn save_memory_snapshot(label: &str, memory_id: MemoryId) {
32 let snapshot = with_memory_manager(|memory_manager| {
33 let mem = memory_manager.get(memory_id);
34 let mut snapshot = vec![0; mem.size() as usize * WASM_PAGE_SIZE_IN_BYTES as usize];
35 mem.read(0, &mut snapshot);
36 snapshot
37 });
38
39 fs::write(
40 format!("src/migration_tests/snapshots/{label}_v{STABLE_MEMORY_VERSION}.bin"),
41 snapshot,
42 )
43 .unwrap();
44 }
45
46 fn generate_address_book_repo_snapshot() {
47 let entries: Vec<AddressBookEntry> = vec![

Calls 2

with_memory_managerFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected