diff --git a/lib/src/storage/fallback_backend.rs b/lib/src/storage/fallback_backend.rs index 4620e58d..68f844f2 100644 --- a/lib/src/storage/fallback_backend.rs +++ b/lib/src/storage/fallback_backend.rs @@ -1,3 +1,5 @@ +//! TODO: This storage is dramatically naive. + use std::collections::BTreeMap; use std::io::Result; use std::sync::{Arc, Mutex, RwLock}; @@ -16,22 +18,15 @@ impl Db { }) } - pub fn open_tree(&self, name: &'static str) -> Tree { - self.trees.lock().unwrap().entry(name).or_default().clone() + pub fn open_tree(&self, name: &'static str) -> Result { + Ok(self.trees.lock().unwrap().entry(name).or_default().clone()) } pub fn flush(&self) -> Result<()> { Ok(()) } - - pub fn get(&self, key: &[u8]) -> Result>> { - self.default.get(key) - } - - pub fn insert(&self, key: &[u8], value: &[u8]) -> Result<()> { - self.default.insert(key, value) - } } + #[derive(Clone, Default)] pub struct Tree { tree: Arc, Vec>>>, @@ -108,4 +103,8 @@ impl Iter { pub fn next(&mut self) { self.current = self.iter.next(); } + + pub fn status(&self) -> Result<()> { + Ok(()) + } }