feat(http): calculate updates' and uuids' dbs size

This commit is contained in:
Alexey Shekhirin
2021-04-09 15:41:24 +03:00
parent ae1655586c
commit adfdb99abc
17 changed files with 121 additions and 25 deletions

View File

@ -8,6 +8,7 @@ use heed::{
use uuid::Uuid;
use super::{Result, UuidError, UUID_STORE_SIZE};
use crate::helpers::EnvSizer;
#[async_trait::async_trait]
pub trait UuidStore {
@ -19,6 +20,7 @@ pub trait UuidStore {
async fn list(&self) -> Result<Vec<(String, Uuid)>>;
async fn insert(&self, name: String, uuid: Uuid) -> Result<()>;
async fn snapshot(&self, path: PathBuf) -> Result<Vec<Uuid>>;
async fn get_size(&self) -> Result<u64>;
}
pub struct HeedUuidStore {
@ -151,4 +153,8 @@ impl UuidStore for HeedUuidStore {
})
.await?
}
async fn get_size(&self) -> Result<u64> {
Ok(self.env.size())
}
}