diff --git a/src/storage/journal.rs b/src/storage/journal.rs index 4be9224..ddc3db1 100644 --- a/src/storage/journal.rs +++ b/src/storage/journal.rs @@ -2,14 +2,16 @@ use ic_stable_structures::{memory_manager::VirtualMemory, Memory}; use crate::error::Error; +#[allow(dead_code)] pub struct CacheJournal { journal: VirtualMemory, } // The cache stored in stable memory for some information that has to be stored between upgrades. impl CacheJournal { + #[allow(dead_code)] pub fn new(journal: VirtualMemory) -> Result, Error> { - let cache_journal = if journal.size() == 0 { + if journal.size() == 0 { journal.grow(1); // write the magic marker @@ -18,7 +20,7 @@ impl CacheJournal { let cache_journal = CacheJournal { journal }; - cache_journal + Ok(cache_journal) } else { // check the marker let mut b = [0u8; 4]; @@ -34,10 +36,8 @@ impl CacheJournal { // init local cache variables //... - cache_journal - }; - - Ok(cache_journal) + Ok(cache_journal) + } } }