sov_first_read_last_write_cache/
lib.rs

1use thiserror::Error;
2
3pub mod cache;
4
5mod access;
6mod utils;
7
8use std::fmt::Display;
9use std::sync::Arc;
10
11pub use access::MergeError;
12
13#[derive(Error, Debug, Eq, PartialEq, Clone, Hash, PartialOrd, Ord)]
14pub struct CacheKey {
15    pub key: Arc<Vec<u8>>,
16}
17
18impl Display for CacheKey {
19    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20        // TODO revisit how we display keys
21        write!(f, "{:?}", self.key)
22    }
23}
24
25#[derive(Error, Debug, Eq, PartialEq, Clone)]
26pub struct CacheValue {
27    pub value: Arc<Vec<u8>>,
28}
29
30impl Display for CacheValue {
31    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
32        // TODO revisit how we display values
33        write!(f, "{:?}", self.value)
34    }
35}