mirror of
https://github.com/vacp2p/pmtree.git
synced 2026-01-08 23:08:02 -05:00
chore: add close db connection feature
This commit is contained in:
@@ -25,4 +25,7 @@ pub trait Database {
|
||||
|
||||
/// Puts the leaves batch to the db
|
||||
fn put_batch(&mut self, subtree: HashMap<DBKey, Value>) -> PmtreeResult<()>;
|
||||
|
||||
/// Closes the db connection
|
||||
fn close(&mut self) -> PmtreeResult<()>;
|
||||
}
|
||||
|
||||
@@ -115,6 +115,11 @@ where
|
||||
})
|
||||
}
|
||||
|
||||
/// Closes the db connection
|
||||
pub fn close(&mut self) -> PmtreeResult<()> {
|
||||
self.db.close()
|
||||
}
|
||||
|
||||
/// Sets a leaf at the specified tree index
|
||||
pub fn set(&mut self, key: usize, leaf: H::Fr) -> PmtreeResult<()> {
|
||||
if key >= self.capacity() {
|
||||
|
||||
Reference in New Issue
Block a user