From 6af722f2ae3df9adae0fd9399148c1da084bc710 Mon Sep 17 00:00:00 2001 From: Brooks Prumo Date: Wed, 15 Sep 2021 15:31:59 -0500 Subject: [PATCH] use Slot from sdk --- bucket_map/src/index_entry.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bucket_map/src/index_entry.rs b/bucket_map/src/index_entry.rs index a5ae3246a8..ba06e2bdd7 100644 --- a/bucket_map/src/index_entry.rs +++ b/bucket_map/src/index_entry.rs @@ -1,13 +1,12 @@ use crate::bucket::Bucket; use crate::bucket_map::RefCount; use crate::data_bucket::DataBucket; +use solana_sdk::clock::Slot; use solana_sdk::pubkey::Pubkey; use std::collections::hash_map::DefaultHasher; use std::fmt::Debug; use std::hash::{Hash, Hasher}; -type NumSlots = u64; - #[repr(C)] #[derive(Debug, Copy, Clone, PartialEq)] // one instance of this per item in the index @@ -18,11 +17,11 @@ pub struct IndexEntry { 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 pub create_bucket_capacity: u8, // see data_location - pub num_slots: NumSlots, // 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 } impl IndexEntry { - pub fn data_bucket_from_num_slots(num_slots: NumSlots) -> u64 { + pub fn data_bucket_from_num_slots(num_slots: Slot) -> u64 { (num_slots as f64).log2().ceil() as u64 // use int log here? }