rename create_bucket_capacity_pow2 to bucket_capacity_when_created_pow2

This commit is contained in:
Brooks Prumo
2021-09-16 15:10:29 -05:00
committed by Jeff Washington (jwash)
parent 340b99931a
commit fd458abc44
2 changed files with 4 additions and 4 deletions

View File

@ -169,7 +169,7 @@ impl<T: Clone + Copy> Bucket<T> {
elem.key = *key; elem.key = *key;
elem.ref_count = ref_count; elem.ref_count = ref_count;
elem.data_location = 0; elem.data_location = 0;
elem.create_bucket_capacity_pow2 = 0; elem.bucket_capacity_when_created_pow2 = 0;
elem.num_slots = 0; elem.num_slots = 0;
//debug!( "INDEX ALLOC {:?} {} {} {}", key, ii, index.capacity, elem_uid ); //debug!( "INDEX ALLOC {:?} {} {} {}", key, ii, index.capacity, elem_uid );
return Ok(ii); return Ok(ii);
@ -257,7 +257,7 @@ impl<T: Clone + Copy> Bucket<T> {
} }
// elem: &mut IndexEntry = self.index.get_mut(elem_ix); // elem: &mut IndexEntry = self.index.get_mut(elem_ix);
elem.data_location = ix; elem.data_location = ix;
elem.create_bucket_capacity_pow2 = best_bucket.capacity_pow2; elem.bucket_capacity_when_created_pow2 = best_bucket.capacity_pow2;
elem.num_slots = data.len() as u64; elem.num_slots = data.len() as u64;
//debug!( "DATA ALLOC {:?} {} {} {}", key, elem.data_location, best_bucket.capacity, elem_uid ); //debug!( "DATA ALLOC {:?} {} {} {}", key, elem.data_location, best_bucket.capacity, elem_uid );
if elem.num_slots > 0 { if elem.num_slots > 0 {

View File

@ -16,7 +16,7 @@ pub struct IndexEntry {
pub ref_count: RefCount, // can this be smaller? Do we ever need more than 4B refcounts? pub ref_count: RefCount, // can this be smaller? Do we ever need more than 4B refcounts?
pub data_location: u64, // smaller? since these are variably sized, this could get tricky. well, actually accountinfo is not variable sized... pub data_location: u64, // smaller? since these are variably sized, this could get tricky. well, actually accountinfo is not variable sized...
// if the bucket doubled, the index can be recomputed using create_bucket_capacity_pow2 // if the bucket doubled, the index can be recomputed using create_bucket_capacity_pow2
pub create_bucket_capacity_pow2: u8, // see data_location pub bucket_capacity_when_created_pow2: u8, // see data_location
pub num_slots: Slot, // can this be smaller? epoch size should ~ be the max len. this is the num elements in the slot list pub num_slots: Slot, // can this be smaller? epoch size should ~ be the max len. this is the num elements in the slot list
} }
@ -36,7 +36,7 @@ impl IndexEntry {
// This function maps the original data location into an index in the current data bucket. // This function maps the original data location into an index in the current data bucket.
// This is coupled with how we resize data buckets. // This is coupled with how we resize data buckets.
pub fn data_loc(&self, bucket: &DataBucket) -> u64 { pub fn data_loc(&self, bucket: &DataBucket) -> u64 {
self.data_location << (bucket.capacity_pow2 - self.create_bucket_capacity_pow2) self.data_location << (bucket.capacity_pow2 - self.bucket_capacity_when_created_pow2)
} }
pub fn read_value<'a, T>(&self, bucket: &'a Bucket<T>) -> Option<(&'a [T], RefCount)> { pub fn read_value<'a, T>(&self, bucket: &'a Bucket<T>) -> Option<(&'a [T], RefCount)> {