feat(rolldb): add method to check if db is empty (#352)
This commit is contained in:
parent
049f424581
commit
472692c4fa
2 changed files with 8 additions and 0 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue