Skip to content

Commit

Permalink
hot owners accumulation needs to be byval
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington committed Apr 13, 2024
1 parent 1221dcf commit c9e3c90
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions accounts-db/src/tiered_storage/owners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl OwnersBlockFormat {
Self::AddressesOnly => {
let mut bytes_written = 0;
for address in &owners_table.owners_set {
bytes_written += file.write_pod(*address)?;
bytes_written += file.write_pod(address)?;
}

Ok(bytes_written)
Expand Down Expand Up @@ -85,19 +85,19 @@ impl OwnersBlockFormat {
/// The in-memory representation of owners block for write.
/// It manages a set of unique addresses of account owners.
#[derive(Debug, Default)]
pub struct OwnersTable<'a> {
owners_set: IndexSet<&'a Pubkey>,
pub struct OwnersTable {
owners_set: IndexSet<Pubkey>,
}

/// OwnersBlock is persisted as a consecutive bytes of pubkeys without any
/// meta-data. For each account meta, it has a owner_offset field to
/// access its owner's address in the OwnersBlock.
impl<'a> OwnersTable<'a> {
impl OwnersTable {
/// Add the specified pubkey as the owner into the OwnersWriterTable
/// if the specified pubkey has not existed in the OwnersWriterTable
/// yet. In any case, the function returns its OwnerOffset.
pub fn insert(&mut self, pubkey: &'a Pubkey) -> OwnerOffset {
let (offset, _existed) = self.owners_set.insert_full(pubkey);
pub fn insert(&mut self, pubkey: &Pubkey) -> OwnerOffset {
let (offset, _existed) = self.owners_set.insert_full(*pubkey);

OwnerOffset(offset as u32)
}
Expand Down

0 comments on commit c9e3c90

Please sign in to comment.