Struct solana_runtime::accounts_db::SplitAncientStorages
source · struct SplitAncientStorages {
ancient_slot_count: usize,
ancient_slots: Vec<Slot>,
first_non_ancient_slot: Slot,
first_chunk_start: Slot,
non_ancient_slot_count: usize,
chunk_count: usize,
normal_slot_range: Range<Slot>,
}
Expand description
results from ‘split_storages_ancient’
Fields§
§ancient_slot_count: usize
§ancient_slots: Vec<Slot>
the specific ancient slots
first_non_ancient_slot: Slot
lowest slot that is not an ancient append vec
first_chunk_start: Slot
slot # of beginning of first aligned chunk starting from the first non ancient slot
non_ancient_slot_count: usize
§chunk_count: usize
chunks to use to iterate the storages
all ancient chunks, the special 0 and last chunks for non-full chunks, and all the ‘full’ chunks of normal slots
normal_slot_range: Range<Slot>
start and end(exclusive) of normal (non-ancient) slots to be scanned
Implementations§
source§impl SplitAncientStorages
impl SplitAncientStorages
sourcefn new(one_epoch_old_slot: Slot, snapshot_storages: &SortedStorages<'_>) -> Self
fn new(one_epoch_old_slot: Slot, snapshot_storages: &SortedStorages<'_>) -> Self
When calculating accounts hash, we break the slots/storages into chunks that remain the same during an entire epoch. a slot is in this chunk of slots: start: (slot / MAX_ITEMS_PER_CHUNK) * MAX_ITEMS_PER_CHUNK end_exclusive: start + MAX_ITEMS_PER_CHUNK So a slot remains in the same chunk whenever it is included in the accounts hash. When the slot gets deleted or gets consumed in an ancient append vec, it will no longer be in its chunk. The results of scanning a chunk of appendvecs can be cached to avoid scanning large amounts of data over and over.
sourcefn get_ancient_slots(
one_epoch_old_slot: Slot,
snapshot_storages: &SortedStorages<'_>
) -> Vec<Slot>
fn get_ancient_slots( one_epoch_old_slot: Slot, snapshot_storages: &SortedStorages<'_> ) -> Vec<Slot>
return all ancient append vec slots from the early slots referenced by ‘snapshot_storages’
sourcefn new_with_ancient_info(
range: &Range<Slot>,
ancient_slots: Vec<Slot>,
first_non_ancient_slot: Slot
) -> Self
fn new_with_ancient_info( range: &Range<Slot>, ancient_slots: Vec<Slot>, first_non_ancient_slot: Slot ) -> Self
create once ancient slots have been identified This is easier to test, removing SortedStorages as a type to deal with here.
sourcefn get_starting_slot_from_normal_chunk(&self, normal_chunk: usize) -> Slot
fn get_starting_slot_from_normal_chunk(&self, normal_chunk: usize) -> Slot
given ‘normal_chunk’, return the starting slot of that chunk in the normal/non-ancient range a normal_chunk is 0<=normal_chunk<=non_ancient_chunk_count non_ancient_chunk_count is chunk_count-ancient_slot_count
sourcefn is_chunk_ancient(&self, chunk: usize) -> bool
fn is_chunk_ancient(&self, chunk: usize) -> bool
ancient slots are the first chunks
Trait Implementations§
source§impl Debug for SplitAncientStorages
impl Debug for SplitAncientStorages
source§impl Default for SplitAncientStorages
impl Default for SplitAncientStorages
source§fn default() -> SplitAncientStorages
fn default() -> SplitAncientStorages
source§impl PartialEq<SplitAncientStorages> for SplitAncientStorages
impl PartialEq<SplitAncientStorages> for SplitAncientStorages
source§fn eq(&self, other: &SplitAncientStorages) -> bool
fn eq(&self, other: &SplitAncientStorages) -> bool
self
and other
values to be equal, and is used
by ==
.