Calculating final bundle size

This commit is contained in:
Dennis Schwerdel 2017-04-16 21:39:50 +02:00
parent cc4a9f40ee
commit 2885dfc933
2 changed files with 6 additions and 6 deletions

View File

@ -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
}
}

View File

@ -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(())
}