basecoin_store/
context.rs1use core::fmt::Debug;
2
3use ics23::CommitmentProof;
4
5use crate::types::{Height, Path, RawHeight};
6use crate::utils::Async;
7
8pub trait Store: Async + Clone {
10 type Error: Debug;
12
13 fn set(&mut self, path: Path, value: Vec<u8>) -> Result<Option<Vec<u8>>, Self::Error>;
15
16 fn get(&self, height: Height, path: &Path) -> Option<Vec<u8>>;
18
19 fn delete(&mut self, path: &Path);
22
23 fn commit(&mut self) -> Result<Vec<u8>, Self::Error>;
25
26 fn apply(&mut self) -> Result<(), Self::Error> {
28 Ok(())
29 }
30
31 fn reset(&mut self) {}
33
34 fn prune(&mut self, height: RawHeight) -> Result<RawHeight, Self::Error> {
36 Ok(height)
37 }
38
39 fn current_height(&self) -> RawHeight;
41
42 fn get_keys(&self, key_prefix: &Path) -> Vec<Path>; }
45
46pub trait ProvableStore: Store {
48 fn root_hash(&self) -> Vec<u8>;
50
51 fn get_proof(&self, height: Height, key: &Path) -> Option<CommitmentProof>;
53}