Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Add return types to generate_index()#21735

Merged
brooksprumo merged 4 commits intosolana-labs:masterfrom
brooksprumo:generate-index-result
Dec 9, 2021
Merged

Add return types to generate_index()#21735
brooksprumo merged 4 commits intosolana-labs:masterfrom
brooksprumo:generate-index-result

Conversation

@brooksprumo
Copy link
Copy Markdown
Contributor

@brooksprumo brooksprumo commented Dec 9, 2021

In preparation to get (and return) the total accounts data len during generate index, I'm adding structs to generate_index() and generate_index_for_slot(). This makes the return values self-documenting.

I personally find this way to be helpful for functions that return non-obvious values. I.e. I wouldn't expect generate_index()'s return value to be the the accounts data len. IMO, having a struct with the named fields does help with that.

Comment thread runtime/src/accounts_db.rs Outdated
@brooksprumo brooksprumo marked this pull request as ready for review December 9, 2021 17:05
Comment thread runtime/src/accounts_db.rs Outdated
@brooksprumo brooksprumo changed the title Add Result types to generate_index() Add return types to generate_index() Dec 9, 2021
@brooksprumo brooksprumo force-pushed the generate-index-result branch from 648fcd5 to 8260c41 Compare December 9, 2021 19:49
Comment thread runtime/src/accounts_db.rs Outdated
Copy link
Copy Markdown
Contributor

@jeffwashington jeffwashington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 9, 2021

Codecov Report

Merging #21735 (864f90e) into master (0224a8b) will decrease coverage by 0.1%.
The diff coverage is 88.0%.

@@            Coverage Diff            @@
##           master   #21735     +/-   ##
=========================================
- Coverage    81.6%    81.4%   -0.2%     
=========================================
  Files         511      511             
  Lines      143320   143425    +105     
=========================================
- Hits       116976   116816    -160     
- Misses      26344    26609    +265     

@brooksprumo brooksprumo merged commit 1528f85 into solana-labs:master Dec 9, 2021
@brooksprumo brooksprumo deleted the generate-index-result branch December 9, 2021 23:15
mergify Bot pushed a commit that referenced this pull request Jan 4, 2022
mergify Bot added a commit that referenced this pull request Jan 4, 2022
(cherry picked from commit 1528f85)

Co-authored-by: Brooks Prumo <brooks@solana.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants