Repository navigation
Rename LedgerMetadataBuilder#closingAt to parameter order - #1835
Merged
Merged
Conversation
The two parameters are long, which can be confusing. Master issue: apache#281
sijie
requested changes
Nov 23, 2018
| (metadata) -> { | ||
| return LedgerMetadataBuilder.from(metadata) | ||
| .closingAt(lastEntry, finalLength).build(); | ||
| .closedAtEntryAndLength(lastEntry, finalLength).build(); |
Member
There was a problem hiding this comment.
I have a different opinion at putting parameter names at method. that means if we want to extend in future to add more stuffs at closing phase, we have to rename the methods across the project. so I would call it closedAt rather than closedAtEntryAndLength.
Contributor
Author
There was a problem hiding this comment.
In that case, we should remove both parameters, and let it be handled by the checkArguments in LedgerMetadata (i.e. require that people call withLength & withLastEntryId)
Member
There was a problem hiding this comment.
sure. but still I think 'closedAt' is better than 'closedAtEntryAndLength' at this point.
sijie
approved these changes
Nov 28, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The two parameters are long, so it can be confusing which order they should go in at the callsite.
This change renames #closingAt to #withClosedState, and remove the parameters. This brings the state change in line with #withInRecoveryState and means the caller has to explicitly call #withLastEntryId and #withLength. There is a runtime validation in LedgerMetadata to ensure that if the state is closed, both parameters have also been set.
Master issue: #281