Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename reader to follower #2867

Merged
merged 1 commit into from
Jan 22, 2021
Merged

Conversation

EncodePanda
Copy link
Contributor

Fixes #2833

@EncodePanda EncodePanda force-pushed the EncodePanda/rename-reader-to-follower branch from d042957 to bdec07f Compare January 14, 2021 10:21
@EncodePanda EncodePanda marked this pull request as draft January 14, 2021 10:22
@EncodePanda EncodePanda changed the title [WIP] Rename reader to follower Rename reader to follower Jan 14, 2021
@EncodePanda EncodePanda force-pushed the EncodePanda/rename-reader-to-follower branch from bdec07f to 736843e Compare January 14, 2021 10:54
@EncodePanda EncodePanda marked this pull request as ready for review January 14, 2021 11:14
@EncodePanda EncodePanda force-pushed the EncodePanda/rename-reader-to-follower branch from 736843e to 54472c0 Compare January 14, 2021 11:19
@EncodePanda EncodePanda requested review from mrBliss and coot and removed request for coot January 14, 2021 11:25
@coot
Copy link
Contributor

coot commented Jan 14, 2021

The changes one the network side looks good to me; I wonder if the consensus report needs to be update as well.

Copy link
Contributor

@mrBliss mrBliss left a comment

Choose a reason for hiding this comment

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

As discussed in the Meet, the alignment still needs to be updated 🙂

@mrBliss
Copy link
Contributor

mrBliss commented Jan 14, 2021

I wonder if the consensus report needs to be update as well.

Apparently, the current version doesn't contain any references to readers 🙂. I have actually written the section on readers in the last week, it will appear shortly in #2853 (and I'll rename them to followers first).

@EncodePanda EncodePanda requested a review from coot January 14, 2021 13:28
@EncodePanda EncodePanda force-pushed the EncodePanda/rename-reader-to-follower branch 2 times, most recently from 5613805 to 8275df6 Compare January 14, 2021 14:04

checkIfReaderExists :: CPS.ReaderId -> Model blk
checkIfFollowerExists :: CPS.FollowerId -> Model blk
Copy link
Contributor

@nfrisby nfrisby Jan 14, 2021

Choose a reason for hiding this comment

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

Just sharing an observation. Alignment breaks like this one are the one reason we chose to not align -> with :: in the ouroboros-consensus/doc/StyleGuide.md. (Note that we also chose to keep :: on the first line for other reasons.)

So, as your judgement call, if you feel like you're fixing up this kind of alignment for almost all of the signatures in some module, feel free to also change all those signatures in such a module to adhere to the StyleGuide.md. EG in this case (depending how many of the other signatures in this file you're already touching), it'd change to:

checkIfFollowerExists ::
     CPS.FollowerId
  -> Model blk
  -> a
  -> Either (ChainDbError blk) a

(I'm suggesting preserving this style despite the StyleGuide.md because we don't want to inflate the diff too much with signatures that would otherwise be unchanged by this PR. Also, the "existing style" of a module is generally to be preserved, despite the StyleGuide.md, unless we have good reason.)

Somewhat separately: in the case of a rename, I would be tempted to have separate commits for the rename and for the alignment-fixup. Not crucial, but I think that would make it easier for me personally to review, for example.

@EncodePanda EncodePanda force-pushed the EncodePanda/rename-reader-to-follower branch 2 times, most recently from 0f59872 to bd5a270 Compare January 19, 2021 12:24
@nfrisby
Copy link
Contributor

nfrisby commented Jan 19, 2021

I see some strays left. Here is an example from each module in which I'm getting hits.

ouroboros-consensus-test/test-storage/Test/Ouroboros/Storage/ChainDB/Model.hs:    = m { cps = CPS.deleteFollower rdrId (cps m) }
ouroboros-consensus-test/test-storage/Test/Ouroboros/Storage/ChainDB/StateMachine.hs:data Cmd blk it rdr
ouroboros-consensus/src/Ouroboros/Consensus/Network/NodeToClient.hs:          (\rdr -> runPeer
ouroboros-consensus/src/Ouroboros/Consensus/Network/NodeToNode.hs:          (\rdr -> runPeerWithLimits

My command was git grep -Ei -e '\brdr' -e 'rdr\b' -e '\breader[^T]' -e 'reader\b' -- 'ouroboros*hs'

So close!

@nfrisby
Copy link
Contributor

nfrisby commented Jan 19, 2021

Wow! That was a lot of lines! I found a few issues. You were very thorough! Again, I really don't think Thomas and I realized how big this would be. Thanks for persevering.

It's also possible that some of my comments were off base -- I wasn't looking at the context in the module, just the diff on GitHub. So feel free to shut me down in some of these comment threads. EG Maybe I applied the Consensus StyleGuide.md to a module that doesn't deserve it.

FYI, I can re-review the fix ups on this first thing tomorrow -- ie by 3 or 4pm Central European.

@nfrisby
Copy link
Contributor

nfrisby commented Jan 19, 2021

The last step will be to squash the commits. Like we chatted about, one big commit is fine for this 👍

@EncodePanda
Copy link
Contributor Author

I see some strays left. Here is an example from each module in which I'm getting hits.

ouroboros-consensus-test/test-storage/Test/Ouroboros/Storage/ChainDB/Model.hs:    = m { cps = CPS.deleteFollower rdrId (cps m) }
ouroboros-consensus-test/test-storage/Test/Ouroboros/Storage/ChainDB/StateMachine.hs:data Cmd blk it rdr
ouroboros-consensus/src/Ouroboros/Consensus/Network/NodeToClient.hs:          (\rdr -> runPeer
ouroboros-consensus/src/Ouroboros/Consensus/Network/NodeToNode.hs:          (\rdr -> runPeerWithLimits

My command was git grep -Ei -e '\brdr' -e 'rdr\b' -e '\breader[^T]' -e 'reader\b' -- 'ouroboros*hs'

So close!

Ha! I know how they got here. After recent patch to memleak some of those variables were introduced and I did not notice that while rebasing. Thanks for the good catch!

@EncodePanda
Copy link
Contributor Author

Ha! I know how they got here. After recent patch to memleak some of those variables were introduced and I did not notice that while rebasing. Thanks for the good catch!

but I also see there were other few that I've missed
my grep-fu not strong enough

@EncodePanda EncodePanda force-pushed the EncodePanda/rename-reader-to-follower branch from bd5a270 to de2049d Compare January 20, 2021 12:52
@EncodePanda
Copy link
Contributor Author

@nfrisby I've added few commits to this PR. Please review them. I will squash everything once I get the final 👍 on this.
Thanks for the detailed and close look on this one.

@EncodePanda EncodePanda force-pushed the EncodePanda/rename-reader-to-follower branch 3 times, most recently from 6aee120 to e3872ab Compare January 20, 2021 17:36
@nfrisby nfrisby force-pushed the EncodePanda/rename-reader-to-follower branch from e3872ab to 3cefd20 Compare January 21, 2021 23:53
@nfrisby
Copy link
Contributor

nfrisby commented Jan 21, 2021

I rebased onto master (no conflicts, it was automatic) and fixed up a couple more alignment hiccups. Some of those hiccups you and I had fixed on our call yesterday, so I'm guessing we accidentally lost them somehow. We probably jumped to the squash without committing first our staged changes?

Anyway, my fixup commit is entirely whitespace. If I show it with the whitespace diff suppressed, it's empty:

$ git show -w 3cefd20c8
commit 3cefd20c8585131235a325df1d2ba9d0028cdfe4 (HEAD -> EncodePanda/rename-reader-to-follower)
Author: Nicolas Frisby <nick.frisby@iohk.io>
Date:   Thu Jan 21 15:51:38 2021 -0800

    TOSQUASH last alignment fixups
$

I'm going to squash it now and then merge! 🙌

Fixes #2833

ouroboros-network has its own set of rules we have to adhere to, thus
the differences

Question is: in Test/ChainProducerState.hs why not going from r to f (as in other files):

1. the r name was somewhat incorrect in the first place because it was
referencing a ReaderState/FollowerState and in other places it was
referencing just the Reader/FollowerState
2. the f name was already taken in few places

Thus to make things a bit more consistent I've decided to go with
/s/r/fs.
Not that for the pattern matching on ChainProducerState I've also made
a decision on renaming the rs to cfs (because that is a chain follower
state) and nrid to cnfid (because that is a chain new follower id)
@nfrisby nfrisby force-pushed the EncodePanda/rename-reader-to-follower branch from 3cefd20 to aee2d1f Compare January 21, 2021 23:56
@nfrisby nfrisby requested a review from mrBliss January 21, 2021 23:57
@nfrisby nfrisby dismissed mrBliss’s stale review January 22, 2021 00:04

Thomas has departed.

@nfrisby
Copy link
Contributor

nfrisby commented Jan 22, 2021

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jan 22, 2021

@iohk-bors iohk-bors bot merged commit 1efb25d into master Jan 22, 2021
@iohk-bors iohk-bors bot deleted the EncodePanda/rename-reader-to-follower branch January 22, 2021 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chain DB: rename reader to follower
4 participants