Skip to content

Commit

Permalink
revert block cache weighter until v2
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-j97 committed Jul 8, 2024
1 parent 6d9089a commit a1912d6
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/block_cache.rs
Original file line number Diff line number Diff line change
@@ -1,9 1,9 @@
use crate::either::{
Either,
Either::{Left, Right},
};
use crate::segment::id::GlobalSegmentId;
use crate::segment::{block_index::IndexBlock, value_block::ValueBlock};
use crate::{
either::Either::{self, Left, Right},
segment::block_index::block_handle::KeyedBlockHandle,
};
use quick_cache::Weighter;
use quick_cache::{sync::Cache, Equivalent};
use std::sync::Arc;
Expand Down Expand Up @@ -40,9 40,12 @@ impl Weighter<CacheKey, Item> for BlockWeighter {
// NOTE: Truncation is fine: blocks are definitely below 4 GiB
#[allow(clippy::cast_possible_truncation)]
match block {
// TODO: need uncompressed data length
Either::Left(block) => block.header.data_length.into(),
Either::Right(block) => block.header.data_length.into(),
Either::Left(block) => block.size() as u64,
Either::Right(block) => block
.items
.iter()
.map(|x| x.end_key.len() std::mem::size_of::<KeyedBlockHandle>())
.sum::<usize>() as u64,
}
}
}
Expand Down

0 comments on commit a1912d6

Please sign in to comment.