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

storage/apply: rename Batch.Commit to Batch.ApplyToStateMachine #39468

Merged
merged 1 commit into from
Aug 8, 2019

Conversation

nvanbenschoten
Copy link
Member

This came out of a discussion with Dan. The method can't be moved
to StateMachine because then we'll need a type switch to handle the
different kinds of Batch implementations, but it can be renamed to
provide more symmetry with StateMachine.ApplySideEffects.

The commit also tries to clean up some of the phrasing around the
persistent state transition updates and the side-effects of these
state transition updates.

Release note: None

This came out of a discussion with Dan. The method can't be moved
to StateMachine because then we'll need a type switch to handle the
different kinds of Batch implementations, but it can be renamed to
provide more symmetry with StateMachine.ApplySideEffects.

The commit also tries to clean up some of the phrasing around the
persistent state transition updates and the side-effects of these
state transition updates.

Release note: None
@nvanbenschoten nvanbenschoten requested a review from danhhz August 8, 2019 19:19
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@danhhz
Copy link
Contributor

danhhz commented Aug 8, 2019

can you elaborate on the type switch? it is similar to the one at the beginning of (*replicaStateMachine).ApplySideEffects or something else?

@nvanbenschoten
Copy link
Member Author

No, this would be a type switch on the type of the Batch passed to the method. A big part of why Batch is an interface is because we're going to introduce an ephemeral batch implementation in the next PR (this was part of #39254 until the very end, but it was pulled before merging because it actually belongs in #38954). This ephemeral batch will return an error from ApplyToStateMachine because it's ... ephemeral.

Making ApplyBatch a method on StateMachine that has specialized behavior for different implementations of Batch instead of letting each implementation of Batch implement an ApplyToStateMachine method seems like the wrong way to go.

@danhhz
Copy link
Contributor

danhhz commented Aug 8, 2019

Gotcha, I forgot about ephemeral batches. LGTM

@nvanbenschoten
Copy link
Member Author

bors r=danhhz

craig bot pushed a commit that referenced this pull request Aug 8, 2019
39468: storage/apply: rename Batch.Commit to Batch.ApplyToStateMachine r=danhhz a=nvanbenschoten

This came out of a discussion with Dan. The method can't be moved
to StateMachine because then we'll need a type switch to handle the
different kinds of Batch implementations, but it can be renamed to
provide more symmetry with StateMachine.ApplySideEffects.

The commit also tries to clean up some of the phrasing around the
persistent state transition updates and the side-effects of these
state transition updates.

Release note: None

Co-authored-by: Nathan VanBenschoten <[email protected]>
@craig
Copy link
Contributor

craig bot commented Aug 8, 2019

Build succeeded

@craig craig bot merged commit 57fee7b into cockroachdb:master Aug 8, 2019
@nvanbenschoten nvanbenschoten deleted the nvanbenschoten/applyToSM branch August 9, 2019 03:05
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.

3 participants