1use crate::*;
2
3use std::collections::HashMap;
4
5pub trait Database {
7 type Config: Default;
9
10 fn new(config: Self::Config) -> PmtreeResult<Self>
12 where
13 Self: Sized;
14
15 fn load(config: Self::Config) -> PmtreeResult<Self>
17 where
18 Self: Sized;
19
20 fn get(&self, key: DBKey) -> PmtreeResult<Option<Value>>;
22
23 fn put(&mut self, key: DBKey, value: Value) -> PmtreeResult<()>;
25
26 fn put_batch(&mut self, subtree: HashMap<DBKey, Value>) -> PmtreeResult<()>;
28
29 fn close(&mut self) -> PmtreeResult<()>;
31}