AcctIdx: insert goes directly to disk to avoid unnecessary allocations (#21490)
* AcctIdx: upsert avoids unnecessary allocation (during startup) * feedback
This commit is contained in:
committed by
GitHub
parent
cb368e6554
commit
b108d7ddaa
@@ -292,6 +292,17 @@ pub enum PreAllocatedAccountMapEntry<T: IndexValue> {
|
||||
Raw((Slot, T)),
|
||||
}
|
||||
|
||||
impl<T: IndexValue> ZeroLamport for PreAllocatedAccountMapEntry<T> {
|
||||
fn is_zero_lamport(&self) -> bool {
|
||||
match self {
|
||||
PreAllocatedAccountMapEntry::Entry(entry) => {
|
||||
entry.slot_list.read().unwrap()[0].1.is_zero_lamport()
|
||||
}
|
||||
PreAllocatedAccountMapEntry::Raw(raw) => raw.1.is_zero_lamport(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: IndexValue> From<PreAllocatedAccountMapEntry<T>> for (Slot, T) {
|
||||
fn from(source: PreAllocatedAccountMapEntry<T>) -> (Slot, T) {
|
||||
match source {
|
||||
|
Reference in New Issue
Block a user