mirror of https://github.com/vacp2p/pmtree.git
chore: add close db connection feature
This commit is contained in:
parent
8b005bb44a
commit
46a39a373f
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue