use ic_stable_structures::{DefaultMemoryImpl, StableBTreeMap, StableCell, RestrictedMemory};
use std::{cell::RefCell, collections::BTreeMap};
pub type RM = RestrictedMemory<DefaultMemoryImpl>;
pub const USER_PAGE_START: u64 = 64;
pub const STABLE_STORAGE_STRUCTURE_PAGE_END: u64 = USER_PAGE_START + 16;
thread_local! {
// Stable storage structure
static STABLE_STORAGE_STRUCTURE: RefCell<StableBTreeMap<u64, u64, RM>> =
RefCell::new(StableBTreeMap::init(
RM::new(DefaultMemoryImpl::default(), USER_PAGE_START..STABLE_STORAGE_STRUCTURE_PAGE_END)
)
);
// Non-stable storage structure
static NON_STABLE_STORAGE_STRUCTURE: RefCell<BTreeMap<Principal, ic_cdk_timers::TimerId>> = RefCell::default();
}
Is it possible to use it this way?
Are there any potential problems?
Is it possible that unstable structural data will occupy the storage space of stable structural data?
What should I do if I want to store ic_cdk_timers::TimerId
in a stable structure