Function solana_ledger::blockstore::find_slot_meta_else_create
source · fn find_slot_meta_else_create<'a>(
db: &Database,
working_set: &'a HashMap<u64, SlotMetaWorkingSetEntry>,
chained_slots: &'a mut HashMap<u64, Rc<RefCell<SlotMeta>>>,
slot_index: u64
) -> Result<Rc<RefCell<SlotMeta>>>
Expand description
Returns the SlotMeta
with the specified slot_index
. The resulting
SlotMeta
could be either from the cache or from the DB. Specifically,
the function:
- Finds the slot metadata in the cache of dirty slot metadata we’ve previously touched, otherwise:
- Searches the database for that slot metadata. If still no luck, then:
- Create a dummy orphan slot in the database.
Also see find_slot_meta_in_cached_state
and find_slot_meta_in_db_else_create
.