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

Introduce type alias Ancestors #9699

Merged
merged 2 commits into from
Apr 27, 2020

Conversation

ryoqun
Copy link
Contributor

@ryoqun ryoqun commented Apr 24, 2020

define a type alias for fewer line breaks and slightly-improved readability. :)

spin-off of #9527; too tired of looking eye-sore fn signatures for newly defined methods in that pr...

no functional change

@ryoqun ryoqun requested a review from sakridge April 24, 2020 05:25
@@ -7,6 +7,8 @@ use std::{

pub type SlotList<T> = Vec<(Slot, T)>;
pub type SlotSlice<'s, T> = &'s [(Slot, T)];
pub type AncestorList = HashMap<Slot, usize>;
Copy link
Contributor Author

@ryoqun ryoqun Apr 24, 2020

Choose a reason for hiding this comment

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

I've chosen this naming to align with those preceding type aliases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, I've selected ???List because I wanted to introduce some thin abstraction from the underlying types (SlotList from Vec; AncestorList from HashMap) for the case that we switch the container types in the future for implmentation changes.

I know ???List is a bit ambiguous to std::collections::LinkedList, but ???Collection or ???Container is too long to type...

Anyway, this is not my strong opinion. :)

@codecov
Copy link

codecov bot commented Apr 24, 2020

Codecov Report

Merging #9699 into master will decrease coverage by 0.0%.
The diff coverage is 100.0%.

@@           Coverage Diff            @@
##           master   #9699     +/-   ##
========================================
- Coverage    80.5%   80.5%   -0.1%     
========================================
  Files         279     279             
  Lines       63933   63933             
========================================
- Hits        51523   51518      -5     
- Misses      12410   12415      +5     

@ryoqun
Copy link
Contributor Author

ryoqun commented Apr 24, 2020

@sakridge Could you review this when you have some free time? :)

@garious
Copy link
Contributor

garious commented Apr 25, 2020

It's not a List (aka Vec). For the abstraction you're looking for, how about calling it Ancestors, which nicely matches the existing variable names?

@ryoqun ryoqun changed the title Introduce type alias AncestorList Introduce type alias Ancestors Apr 25, 2020
@ryoqun
Copy link
Contributor Author

ryoqun commented Apr 25, 2020

It's not a List (aka Vec). For the abstraction you're looking for, how about calling it Ancestors, which nicely matches the existing variable names?

@garious Yeah, that sounds good. Thanks for commenting! I've just renamed: af42669

@garious
Copy link
Contributor

garious commented Apr 27, 2020

:shipit:

@ryoqun ryoqun merged commit 9918539 into solana-labs:master Apr 27, 2020
@ryoqun ryoqun mentioned this pull request Apr 27, 2020
5 tasks
@ryoqun ryoqun added the v1.1 label May 13, 2020
mergify bot pushed a commit that referenced this pull request May 13, 2020
* Introduce type alias AncestorList

* Rename AncestorList => Ancestors

(cherry picked from commit 9918539)
@ryoqun ryoqun added the v1.0 label May 13, 2020
mergify bot pushed a commit that referenced this pull request May 13, 2020
* Introduce type alias AncestorList

* Rename AncestorList => Ancestors

(cherry picked from commit 9918539)

# Conflicts:
#	accounts-bench/src/main.rs
#	runtime/src/accounts_db.rs
#	runtime/src/accounts_index.rs
@ryoqun
Copy link
Contributor Author

ryoqun commented May 13, 2020

context: trying backporting for #9527

solana-grimes pushed a commit that referenced this pull request May 13, 2020
solana-grimes pushed a commit that referenced this pull request May 13, 2020
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.

2 participants