mirror of
https://github.com/dswd/zvault
synced 2025-03-15 05:12:45 +00:00
Calculating final bundle size
This commit is contained in:
parent
cc4a9f40ee
commit
2885dfc933
src
@ -135,13 +135,13 @@ impl BundleWriter {
|
||||
Ok(StoredBundle { path: path, info: info })
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn size(&self) -> usize {
|
||||
self.data.len()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn raw_size(&self) -> usize {
|
||||
self.raw_size
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn estimate_final_size(&self) -> usize {
|
||||
self.data.len() + self.chunk_count * 20 + 500
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ impl Repository {
|
||||
BundleMode::Meta => &mut self.meta_bundle
|
||||
};
|
||||
if let Some(ref writer) = *writer {
|
||||
(writer.size(), writer.raw_size())
|
||||
(writer.estimate_final_size(), writer.raw_size())
|
||||
} else {
|
||||
return Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user