guardian_db/stores/base_store/
noop_index.rs1use crate::error::GuardianError;
2use crate::ipfs_log::{entry::Entry, log::Log};
3use crate::traits::StoreIndex;
4
5pub struct NoopIndex;
6
7pub fn new_noop_index(
10 _public_key: &[u8],
11) -> Box<dyn StoreIndex<Error = GuardianError> + Send + Sync> {
12 Box::new(NoopIndex)
13}
14
15impl StoreIndex for NoopIndex {
18 type Error = GuardianError;
21
22 fn contains_key(&self, _key: &str) -> std::result::Result<bool, Self::Error> {
24 Ok(false)
25 }
26
27 fn get_bytes(&self, _key: &str) -> std::result::Result<Option<Vec<u8>>, Self::Error> {
29 Ok(None)
30 }
31
32 fn keys(&self) -> std::result::Result<Vec<String>, Self::Error> {
34 Ok(Vec::new())
35 }
36
37 fn len(&self) -> std::result::Result<usize, Self::Error> {
39 Ok(0)
40 }
41
42 fn is_empty(&self) -> std::result::Result<bool, Self::Error> {
44 Ok(true)
45 }
46
47 fn update_index(
49 &mut self,
50 _oplog: &Log,
51 _entries: &[Entry],
52 ) -> std::result::Result<(), Self::Error> {
53 Ok(())
54 }
55
56 fn clear(&mut self) -> std::result::Result<(), Self::Error> {
58 Ok(())
59 }
60}