From 3db7eaf1fcb4ca42ada71461b1aaf595ebafda21 Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang <93241502+yhchiang-sol@users.noreply.github.com> Date: Mon, 13 Nov 2023 12:05:25 -0800 Subject: [PATCH] [TieredStorage] Improve param naming of IndexBlockFormat (#34033) #### Problem In IndexBlockFormat, both `IndexOffset` and `AccountOffset` parameters are named `offset` in some functions which could be confusing. #### Summary of Changes Renamed `offset` to `index_offset` and `account_offset` to improve readability. --- accounts-db/src/tiered_storage/index.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/accounts-db/src/tiered_storage/index.rs b/accounts-db/src/tiered_storage/index.rs index cd8b2a33c82529..ca972f8f56057a 100644 --- a/accounts-db/src/tiered_storage/index.rs +++ b/accounts-db/src/tiered_storage/index.rs @@ -80,14 +80,14 @@ impl IndexBlockFormat { &self, map: &'a Mmap, footer: &TieredStorageFooter, - offset: IndexOffset, + index_offset: IndexOffset, ) -> TieredStorageResult<&'a Pubkey> { - let offset = match self { + let account_offset = match self { Self::AddressAndOffset => { - footer.index_block_offset as usize + std::mem::size_of::() * offset.0 + footer.index_block_offset as usize + std::mem::size_of::() * index_offset.0 } }; - let (address, _) = get_type::(map, offset)?; + let (address, _) = get_type::(map, account_offset)?; Ok(address) } @@ -96,14 +96,14 @@ impl IndexBlockFormat { &self, map: &Mmap, footer: &TieredStorageFooter, - offset: IndexOffset, + index_offset: IndexOffset, ) -> TieredStorageResult { match self { Self::AddressAndOffset => { - let offset = footer.index_block_offset as usize + let account_offset = footer.index_block_offset as usize + std::mem::size_of::() * footer.account_entry_count as usize - + offset.0 * std::mem::size_of::(); - let (account_block_offset, _) = get_type(map, offset)?; + + index_offset.0 * std::mem::size_of::(); + let (account_block_offset, _) = get_type(map, account_offset)?; Ok(AccountOffset { block: *account_block_offset, })