mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 00:55:00 +08:00
apply review comments
This commit is contained in:
parent
bf94f89035
commit
a858531574
@ -94,15 +94,17 @@ impl FileStore {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_total_size(&self) -> Result<u64> {
|
/// Compute the size of all the updates contained in the file store.
|
||||||
|
pub fn compute_total_size(&self) -> Result<u64> {
|
||||||
let mut total = 0;
|
let mut total = 0;
|
||||||
for uuid in self.all_uuids()? {
|
for uuid in self.all_uuids()? {
|
||||||
total += self.get_size(uuid?)?;
|
total += self.compute_size(uuid?).unwrap_or_default();
|
||||||
}
|
}
|
||||||
Ok(total)
|
Ok(total)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_size(&self, uuid: Uuid) -> Result<u64> {
|
/// Compute the size of one update
|
||||||
|
pub fn compute_size(&self, uuid: Uuid) -> Result<u64> {
|
||||||
Ok(self.get_update(uuid)?.metadata()?.len())
|
Ok(self.get_update(uuid)?.metadata()?.len())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,8 +903,8 @@ impl IndexScheduler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The size on disk taken by all the updates files contained in the `IndexScheduler`, in bytes.
|
/// The size on disk taken by all the updates files contained in the `IndexScheduler`, in bytes.
|
||||||
pub fn update_file_size(&self) -> Result<u64> {
|
pub fn compute_update_file_size(&self) -> Result<u64> {
|
||||||
Ok(self.file_store.update_total_size()?)
|
Ok(self.file_store.compute_total_size()?)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Delete a file from the index scheduler.
|
/// Delete a file from the index scheduler.
|
||||||
|
@ -514,7 +514,7 @@ impl IndexScheduler {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.any(|uuid| uuid.as_ref().unwrap() == &content_file),
|
.any(|uuid| uuid.as_ref().unwrap() == &content_file),
|
||||||
"Could not find uuid `{content_file}` in the file_store. Available uuids are {:?}.",
|
"Could not find uuid `{content_file}` in the file_store. Available uuids are {:?}.",
|
||||||
self.file_store.all_uuids().unwrap().collect::<Result<Vec<_>>>().unwrap(),
|
self.file_store.all_uuids().unwrap().collect::<std::result::Result<Vec<_>, file_store::Error>>().unwrap(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Status::Succeeded | Status::Failed | Status::Canceled => {
|
Status::Succeeded | Status::Failed | Status::Canceled => {
|
||||||
|
@ -281,7 +281,7 @@ pub fn create_all_stats(
|
|||||||
|
|
||||||
database_size += index_scheduler.size()?;
|
database_size += index_scheduler.size()?;
|
||||||
database_size += auth_controller.size()?;
|
database_size += auth_controller.size()?;
|
||||||
database_size += index_scheduler.update_file_size()?;
|
database_size += index_scheduler.compute_update_file_size()?;
|
||||||
|
|
||||||
let stats = Stats { database_size, last_update: last_task, indexes };
|
let stats = Stats { database_size, last_update: last_task, indexes };
|
||||||
Ok(stats)
|
Ok(stats)
|
||||||
|
Loading…
Reference in New Issue
Block a user