Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions accounts-db/src/accounts_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ impl AccountsFile {
}

/// calls `callback` with the account located at the specified index offset.
pub fn get_stored_account_meta_callback<'a, Ret>(
&'a self,
pub fn get_stored_account_meta_callback<Ret>(
&self,
offset: usize,
callback: impl FnMut(StoredAccountMeta<'a>) -> Ret,
callback: impl for<'local> FnMut(StoredAccountMeta<'local>) -> Ret,
) -> Option<Ret> {
match self {
Self::AppendVec(av) => av.get_stored_account_meta_callback(offset, callback),
Expand Down Expand Up @@ -205,7 +205,10 @@ impl AccountsFile {
}

/// Iterate over all accounts and call `callback` with each account.
pub(crate) fn scan_accounts(&self, callback: impl for<'a> FnMut(StoredAccountMeta<'a>)) {
pub(crate) fn scan_accounts(
&self,
callback: impl for<'local> FnMut(StoredAccountMeta<'local>),
) {
match self {
Self::AppendVec(av) => av.scan_accounts(callback),
Self::TieredStorage(ts) => {
Expand Down
11 changes: 7 additions & 4 deletions accounts-db/src/append_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,10 @@ impl AppendVec {
}

/// calls `callback` with the account located at the specified index offset.
pub fn get_stored_account_meta_callback<'a, Ret>(
&'a self,
pub fn get_stored_account_meta_callback<Ret>(
&self,
offset: usize,
mut callback: impl FnMut(StoredAccountMeta<'a>) -> Ret,
mut callback: impl for<'local> FnMut(StoredAccountMeta<'local>) -> Ret,
) -> Option<Ret> {
self.get_stored_account_meta(offset)
.map(|(account, _offset)| callback(account))
Expand Down Expand Up @@ -688,7 +688,10 @@ impl AppendVec {

/// Iterate over all accounts and call `callback` with each account.
#[allow(clippy::blocks_in_conditions)]
pub(crate) fn scan_accounts(&self, mut callback: impl for<'a> FnMut(StoredAccountMeta<'a>)) {
pub(crate) fn scan_accounts(
&self,
mut callback: impl for<'local> FnMut(StoredAccountMeta<'local>),
) {
let mut offset = 0;
while self
.get_stored_account_meta_callback(offset, |account| {
Expand Down
8 changes: 4 additions & 4 deletions accounts-db/src/tiered_storage/hot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,10 +525,10 @@ impl HotStorageReader {
}

/// calls `callback` with the account located at the specified index offset.
pub fn get_stored_account_meta_callback<'a, Ret>(
&'a self,
pub fn get_stored_account_meta_callback<Ret>(
&self,
index_offset: IndexOffset,
mut callback: impl FnMut(StoredAccountMeta<'a>) -> Ret,
mut callback: impl for<'local> FnMut(StoredAccountMeta<'local>) -> Ret,
) -> TieredStorageResult<Option<Ret>> {
let account = self.get_stored_account_meta(index_offset)?;
Ok(account.map(|(account, _offset)| callback(account)))
Expand Down Expand Up @@ -633,7 +633,7 @@ impl HotStorageReader {
/// Iterate over all accounts and call `callback` with each account.
pub(crate) fn scan_accounts(
&self,
mut callback: impl for<'a> FnMut(StoredAccountMeta<'a>),
mut callback: impl for<'local> FnMut(StoredAccountMeta<'local>),
) -> TieredStorageResult<()> {
for i in 0..self.footer.account_entry_count {
self.get_stored_account_meta_callback(IndexOffset(i), &mut callback)?;
Expand Down
8 changes: 4 additions & 4 deletions accounts-db/src/tiered_storage/readable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ impl TieredStorageReader {
}

/// calls `callback` with the account located at the specified index offset.
pub fn get_stored_account_meta_callback<'a, Ret>(
&'a self,
pub fn get_stored_account_meta_callback<Ret>(
&self,
index_offset: IndexOffset,
callback: impl FnMut(StoredAccountMeta<'a>) -> Ret,
callback: impl for<'local> FnMut(StoredAccountMeta<'local>) -> Ret,
) -> TieredStorageResult<Option<Ret>> {
match self {
Self::Hot(hot) => hot.get_stored_account_meta_callback(index_offset, callback),
Expand Down Expand Up @@ -148,7 +148,7 @@ impl TieredStorageReader {
/// Iterate over all accounts and call `callback` with each account.
pub(crate) fn scan_accounts(
&self,
callback: impl for<'a> FnMut(StoredAccountMeta<'a>),
callback: impl for<'local> FnMut(StoredAccountMeta<'local>),
) -> TieredStorageResult<()> {
match self {
Self::Hot(hot) => hot.scan_accounts(callback),
Expand Down