Calculating final bundle size

pull/10/head
Dennis Schwerdel 5 years ago
parent cc4a9f40ee
commit 2885dfc933
  1. 8
      src/bundledb/writer.rs
  2. 2
      src/repository/basic_io.rs

@ -136,12 +136,12 @@ impl BundleWriter {
}
#[inline]
pub fn size(&self) -> usize {
self.data.len()
pub fn raw_size(&self) -> usize {
self.raw_size
}
#[inline]
pub fn raw_size(&self) -> usize {
self.raw_size
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…
Cancel
Save