diff --git a/read_buffer/src/lib.rs b/read_buffer/src/lib.rs index 7d7f2052a7..b5a65f2eb8 100644 --- a/read_buffer/src/lib.rs +++ b/read_buffer/src/lib.rs @@ -211,16 +211,16 @@ impl Database { } /// Returns the total estimated size in bytes of the database. - pub fn size(&self) -> u64 { + pub fn size(&self) -> usize { let base_size = std::mem::size_of::(); let partition_data = self.data.read().unwrap(); - base_size as u64 + base_size + partition_data .partitions .iter() - .map(|(name, partition)| name.len() as u64 + partition.size()) - .sum::() + .map(|(name, partition)| name.len() + partition.size() as usize) + .sum::() } pub fn rows(&self) -> u64 { @@ -723,16 +723,18 @@ impl Partition { /// The total estimated size in bytes of the `Partition` and all contained /// data. - pub fn size(&self) -> u64 { + /// + /// TODO(edd): to be deprecated + pub fn size(&self) -> usize { let base_size = std::mem::size_of::() + self.key.len(); let chunk_data = self.data.read().unwrap(); - base_size as u64 + (base_size as u64 + chunk_data .chunks .values() - .map(|chunk| std::mem::size_of::() as u64 + chunk.size()) - .sum::() + .map(|chunk| std::mem::size_of::() as u64 + chunk.size() as u64) + .sum::()) as usize } /// The total estimated size in bytes of the specified chunk id @@ -741,7 +743,7 @@ impl Partition { chunk_data .chunks .get(&chunk_id) - .map(|chunk| chunk.size()) + .map(|chunk| chunk.size() as u64) .unwrap_or(0) // treat unknown chunks as zero size } }