From db5cdbedaec45f086dd5f26e9ccfecdd894abf4c Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Fri, 31 Mar 2023 11:08:16 -0500 Subject: [PATCH] disk index remove dead code (#30999) --- bucket_map/src/index_entry.rs | 71 +---------------------------------- 1 file changed, 1 insertion(+), 70 deletions(-) diff --git a/bucket_map/src/index_entry.rs b/bucket_map/src/index_entry.rs index 34dd4ad827de01..8d6bc753d0a264 100644 --- a/bucket_map/src/index_entry.rs +++ b/bucket_map/src/index_entry.rs @@ -11,19 +11,6 @@ use { std::{fmt::Debug, marker::PhantomData}, }; -/// in use/occupied -const OCCUPIED_OCCUPIED: u64 = 1; -/// free, ie. not occupied -const OCCUPIED_FREE: u64 = 0; - -/// header for elements in a bucket -/// needs to be multiple of size_of::() -#[repr(C)] -struct OccupiedHeader { - /// OCCUPIED_OCCUPIED or OCCUPIED_FREE - occupied: u64, -} - /// allocated in `contents` in a BucketStorage pub struct BucketWithBitVec { pub occupied: BitVec, @@ -169,24 +156,6 @@ impl IndexEntryPlaceInBucket { index_entry.multiple_slots = MultipleSlots::default(); } - pub fn set_storage_capacity_when_created_pow2( - &self, - index_bucket: &mut BucketStorage>, - storage_capacity_when_created_pow2: u8, - ) { - self.get_multiple_slots_mut(index_bucket) - .set_storage_capacity_when_created_pow2(storage_capacity_when_created_pow2); - } - - pub fn set_storage_offset( - &self, - index_bucket: &mut BucketStorage>, - storage_offset: u64, - ) { - self.get_multiple_slots_mut(index_bucket) - .set_storage_offset(storage_offset); - } - pub(crate) fn get_multiple_slots<'a>( &self, index_bucket: &'a BucketStorage>, @@ -255,22 +224,7 @@ impl IndexEntryPlaceInBucket { #[cfg(test)] mod tests { - use { - super::*, - std::{path::PathBuf, sync::Arc}, - tempfile::tempdir, - }; - - impl IndexEntry { - pub fn new(key: Pubkey) -> Self { - IndexEntry { - key, - packed_ref_count: PackedRefCount::default(), - multiple_slots: MultipleSlots::default(), - _phantom: PhantomData, - } - } - } + use super::*; /// verify that accessors for storage_offset and capacity_when_created are /// correct and independent @@ -298,29 +252,6 @@ mod tests { assert_eq!(std::mem::size_of::>(), 32 + 8 + 8 + 8); } - fn index_bucket_for_testing() -> BucketStorage> { - let tmpdir = tempdir().unwrap(); - let paths: Vec = vec![tmpdir.path().to_path_buf()]; - assert!(!paths.is_empty()); - - // `new` here creates a file in `tmpdir`. Once the file is created, `tmpdir` can be dropped without issue. - BucketStorage::>::new( - Arc::new(paths), - 1, - std::mem::size_of::>() as u64, - 1, - Arc::default(), - Arc::default(), - ) - } - - fn index_entry_for_testing() -> ( - BucketStorage>, - IndexEntryPlaceInBucket, - ) { - (index_bucket_for_testing(), IndexEntryPlaceInBucket::new(0)) - } - #[test] #[should_panic(expected = "New storage offset must fit into 7 bytes!")] fn test_set_storage_offset_value_too_large() {