expose the size methods

This commit is contained in:
Irevoire 2022-08-11 11:15:46 +02:00
parent e96b852107
commit 4aae07d5f5
No known key found for this signature in database
GPG key ID: 7A6A970C96104F1B
14 changed files with 39 additions and 17 deletions

View file

@ -223,6 +223,16 @@ impl Index {
self.env.path()
}
/// Returns the size used by the index without the cached pages.
pub fn used_size(&self) -> Result<u64> {
Ok(self.env.non_free_pages_size()?)
}
/// Returns the real size used by the index.
pub fn on_disk_size(&self) -> Result<u64> {
Ok(self.env.real_disk_size()?)
}
pub fn copy_to_path<P: AsRef<Path>>(&self, path: P, option: CompactionOption) -> Result<File> {
self.env.copy_to_path(path, option).map_err(Into::into)
}