feat(rolldb): add method to check if db is empty (#352)
This commit is contained in:
parent
e54b493f5d
commit
ffcd70c57a
2 changed files with 8 additions and 0 deletions
|
|
@ -265,6 +265,10 @@ impl Store {
|
||||||
Ok(false)
|
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> {
|
pub fn destroy(path: impl AsRef<Path>) -> Result<(), Error> {
|
||||||
DB::destroy(&Options::default(), path).map_err(|_| Error::IO)
|
DB::destroy(&Options::default(), path).map_err(|_| Error::IO)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -355,6 +355,10 @@ impl Store {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
WalKV::is_empty(&self.db)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn destroy(path: impl AsRef<Path>) -> Result<(), Error> {
|
pub fn destroy(path: impl AsRef<Path>) -> Result<(), Error> {
|
||||||
DB::destroy(&Options::default(), path).map_err(|_| Error::IO)
|
DB::destroy(&Options::default(), path).map_err(|_| Error::IO)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue