diff --git a/src/database.rs b/src/database.rs index 9510f61..55f7989 100644 --- a/src/database.rs +++ b/src/database.rs @@ -25,4 +25,7 @@ pub trait Database { /// Puts the leaves batch to the db fn put_batch(&mut self, subtree: HashMap) -> PmtreeResult<()>; + + /// Closes the db connection + fn close(&mut self) -> PmtreeResult<()>; } diff --git a/src/tree.rs b/src/tree.rs index 7272945..88b6df8 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -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() {