mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
feat(http): calculate updates' and uuids' dbs size
This commit is contained in:
parent
ae1655586c
commit
adfdb99abc
17 changed files with 121 additions and 25 deletions
16
meilisearch-http/src/helpers/env.rs
Normal file
16
meilisearch-http/src/helpers/env.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
use walkdir::WalkDir;
|
||||
|
||||
pub trait EnvSizer {
|
||||
fn size(&self) -> u64;
|
||||
}
|
||||
|
||||
impl EnvSizer for heed::Env {
|
||||
fn size(&self) -> u64 {
|
||||
WalkDir::new(self.path())
|
||||
.into_iter()
|
||||
.filter_map(|entry| entry.ok())
|
||||
.filter_map(|entry| entry.metadata().ok())
|
||||
.filter(|metadata| metadata.is_file())
|
||||
.fold(0, |acc, m| acc + m.len())
|
||||
}
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
pub mod authentication;
|
||||
pub mod compression;
|
||||
mod env;
|
||||
|
||||
pub use authentication::Authentication;
|
||||
pub use env::EnvSizer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue