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

Support mutable state in PersistentBehavior #25740

Closed
patriknw opened this issue Oct 4, 2018 · 0 comments
Closed

Support mutable state in PersistentBehavior #25740

patriknw opened this issue Oct 4, 2018 · 0 comments
Assignees
Milestone

Comments

@patriknw
Copy link
Member

patriknw commented Oct 4, 2018

The reason we only support immutable state is that it is stored as snapshot asynchronously.

For Java it's cumbersome to be strictly immutable, and less familiar.

The builders for event and command dispatch work fine when defined outside the State, but if we want to support a ADT style where the actual logic of how to apply the events is defined in the concrete State classes. Due to lack of pattern matching in Java we would have to use builders for matching on the events, but creating a new builder for each invocation seems very wasteful and contradicts the idea that a builder is created once to construct the function, which is then invoked many times.
By allowing mutable State classes the builder can be used inside the state class.

Two solutions were suggested:

  • don't process any new commands while snapshotting is in progress (like for events), possibility to opt-out if state is immutable
  • serialize before sending to snapshot store

Some experiments in #25729

@patriknw patriknw added 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted t:persistence t:typed labels Oct 4, 2018
@patriknw patriknw self-assigned this Jan 21, 2019
@patriknw patriknw added 3 - in progress Someone is working on this ticket and removed 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted labels Jan 21, 2019
@patriknw patriknw removed the 3 - in progress Someone is working on this ticket label Feb 22, 2019
@patriknw patriknw added this to the 2.5.22 milestone Feb 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant