Skip to content

Commit

Permalink
feat(rolldb): add method to check if db is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega committed Dec 11, 2023
1 parent 049f424 commit 90a88cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pallas-rolldb/src/chain/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ impl Store {
Ok(false)
}

pub fn is_empty(&self) -> bool {
HashBySlotKV::is_empty(&self.db) && BlockByHashKV::is_empty(&self.db)
}

pub fn destroy(path: impl AsRef<Path>) -> Result<(), Error> {
DB::destroy(&Options::default(), path).map_err(|_| Error::IO)
}
Expand Down
4 changes: 4 additions & 0 deletions pallas-rolldb/src/wal/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ impl Store {
Ok(())
}

pub fn is_empty(&self) -> bool {
WalKV::is_empty(&self.db)
}

pub fn destroy(path: impl AsRef<Path>) -> Result<(), Error> {
DB::destroy(&Options::default(), path).map_err(|_| Error::IO)
}
Expand Down

0 comments on commit 90a88cc

Please sign in to comment.