chore: Update Blockstore::get_slots_since() doc comments (#31134)

Additionally, change the function definition to use Slot instead of u64.
Slot is defined as an alias of u64 so these are functionally equivalent,
but using Slot over u64 is more expressive of the intent.
This commit is contained in:
steviez 2023-04-11 02:39:31 -05:00 committed by GitHub
parent 814de50f2a
commit 0eec1ad57f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -3034,13 +3034,14 @@ impl Blockstore {
entries.into_iter().flatten().collect()
}
// Returns slots connecting to any element of the list `slots`.
pub fn get_slots_since(&self, slots: &[u64]) -> Result<HashMap<u64, Vec<u64>>> {
/// Returns a mapping from each elements of `slots` to a list of the
/// element's children slots.
pub fn get_slots_since(&self, slots: &[Slot]) -> Result<HashMap<Slot, Vec<Slot>>> {
let slot_metas: Result<Vec<Option<SlotMeta>>> =
self.meta_cf.multi_get(slots.to_vec()).into_iter().collect();
let slot_metas = slot_metas?;
let result: HashMap<u64, Vec<u64>> = slots
let result: HashMap<Slot, Vec<Slot>> = slots
.iter()
.zip(slot_metas)
.filter_map(|(slot, meta)| meta.map(|meta| (*slot, meta.next_slots.to_vec())))