From dfe50cff110e78f3af74a233d4809331ad594aa8 Mon Sep 17 00:00:00 2001 From: Tpt Date: Sat, 23 Oct 2021 19:12:55 +0200 Subject: [PATCH] Fixes WASM builds --- lib/src/storage/fallback_backend.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) 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(()) + } }