1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use crate::{Sandbox, StorageKey};
use ceres_executor::Result;
use ceres_std::Vec;
impl Sandbox {
pub fn get_storage(&self, key: &StorageKey) -> Result<Option<Vec<u8>>> {
log::debug!(
"(get_storage) {:?} ({:?})",
key,
self.cache.borrow().active()
);
let v = self.cache.borrow().active_get(key).map(|v| v.to_vec());
Ok(v)
}
pub fn set_storage(&mut self, key: StorageKey, value: Vec<u8>) -> Result<()> {
log::debug!(
"(set_storage) {:?},{:?} ({:?})",
key,
value,
self.cache.borrow().active(),
);
self.cache.borrow_mut().active_set(key, value);
Ok(())
}
}