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