mirror of https://github.com/dswd/zvault
Calculating final bundle size
This commit is contained in:
parent
cc4a9f40ee
commit
2885dfc933
|
@ -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…
Reference in New Issue