pub fn upsert(
        &self,
        slot: Slot,
        pubkey: &Pubkey,
        account_owner: &Pubkey,
        account_data: &[u8],
        account_indexes: &AccountSecondaryIndexes,
        account_info: T,
        reclaims: &mut SlotList<T>,
    ) -> bool {
        let is_newly_inserted = {
            let w_account_entry =
                self.get_account_write_entry_else_create(pubkey, slot, &account_info);
            // We don't atomically update both primary index and secondary index together.
            // This certainly creates small time window with inconsistent state across the two indexes.
            // However, this is acceptable because:
            //
            //  - A strict consistent view at any given moment of time is not necessary, because the only
            //  use case for the secondary index is `scan`, and `scans` are only supported/require consistency
            //  on frozen banks, and this inconsistency is only possible on working banks.
            //
            //  - The secondary index is never consulted as primary source of truth for gets/stores.
            //  So, what the accounts_index sees alone is sufficient as a source of truth for other non-scan
            //  account operations.
            if account_info.is_zero_lamport() {
                self.zero_lamport_pubkeys.insert(*pubkey);
            }
            if let Some(mut w_account_entry) = w_account_entry {
                w_account_entry.update(slot, account_info, reclaims);
                false
            } else {
                true
            }
        };
        self.update_secondary_indexes(pubkey, account_owner, account_data, account_indexes);
        is_newly_inserted
    }
// Updates the given pubkey at the given slot with the new account information.
// Returns true if the pubkey was newly inserted into the index, otherwise, if the
// pubkey updates an existing entry in the index, returns false.
Updates the given pubkey at the given slot with the new account information.
Returns true if the pubkey was newly inserted into the index, otherwise, if the
pubkey updates an existing entry in the index, returns false.
Updates the given pubkey at the given slot with the new account information . Returns true if the pubkey was newly inserted into the index otherwise if the pubkey updates an existing entry in the index returns false .
pub fn upsert(
        &self,
        slot: Slot,
        pubkey: &Pubkey,
        account_owner: &Pubkey,
        account_data: &[u8],
        account_indexes: &AccountSecondaryIndexes,
        account_info: T,
        reclaims: &mut SlotList<T>,
    ) -> bool {
        let is_newly_inserted = {
            let w_account_entry =
                self.get_account_write_entry_else_create(pubkey, slot, &account_info);
            // We don't atomically update both primary index and secondary index together.
            // This certainly creates small time window with inconsistent state across the two indexes.
            // However, this is acceptable because:
            //
            //  - A strict consistent view at any given moment of time is not necessary, because the only
            //  use case for the secondary index is `scan`, and `scans` are only supported/require consistency
            //  on frozen banks, and this inconsistency is only possible on working banks.
            //
            //  - The secondary index is never consulted as primary source of truth for gets/stores.
            //  So, what the accounts_index sees alone is sufficient as a source of truth for other non-scan
            //  account operations.
            if account_info.is_zero_lamport() {
                self.zero_lamport_pubkeys.insert(*pubkey);
            }
            if let Some(mut w_account_entry) = w_account_entry {
                w_account_entry.update(slot, account_info, reclaims);
                false
            } else {
                true
            }
        };
        self.update_secondary_indexes(pubkey, account_owner, account_data, account_indexes);
        is_newly_inserted
    }
pub fn upsert ( & self , slot : Slot , pubkey : & Pubkey , account_owner : & Pubkey , account_data : & [ u8 ] , account_indexes : & AccountSecondaryIndexes , account_info : T , reclaims : & mut SlotList < T > , ) -> bool { let is_newly_inserted = { let w_account_entry = self . get_account_write_entry_else_create ( pubkey , slot , & account_info ) ; // We don't atomically update both primary index and secondary index together. // This certainly creates small time window with inconsistent state across the two indexes. // However, this is acceptable because: // //  - A strict consistent view at any given moment of time is not necessary, because the only //  use case for the secondary index is `scan`, and `scans` are only supported/require consistency //  on frozen banks, and this inconsistency is only possible on working banks. // //  - The secondary index is never consulted as primary source of truth for gets/stores. //  So, what the accounts_index sees alone is sufficient as a source of truth for other non-scan //  account operations. if account_info . is_zero_lamport ( ) { self . zero_lamport_pubkeys . insert ( * pubkey ) ; } if let Some ( mut w_account_entry ) = w_account_entry { w_account_entry . update ( slot , account_info , reclaims ) ; false } else { true } } ; self . update_secondary_indexes ( pubkey , account_owner , account_data , account_indexes ) ; is_newly_inserted }
Updates the given pubkey at the given slot with the new account information.
Updates the given pubkey at the given slot with the new account information .
&self
slot
Slot
pubkey
&Pubkey
account_owner
&Pubkey
account_data
&[u8]
account_indexes
&AccountSecondaryIndexes
account_info
T
reclaims
&mut SlotList<T>
&self
slot
Slot
pubkey
&Pubkey
account_owner
&Pubkey
account_data
&[u8]
account_indexes
&AccountSecondaryIndexes
account_info
T
reclaims
&mut SlotList<T>