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

Design discussion: moving towards a SerializerWithStringManifest-based Serializer? #26

Open
raboof opened this issue Oct 14, 2015 · 2 comments

Comments

@raboof
Copy link
Member

raboof commented Oct 14, 2015

With akka 2.4's SerializerWithStringManifest, things can get much simpler: we don't need a PersistedCodec anymore.

I think it would make sense to rename the current StaminaAkkaSerializer to something like CodecBasedStaminaAkkaSerializer (for compatibility with 'old' persisted events and use cases where you do want a codec) and create a new StaminaAkkaSerializer based on SerializerWithStringManifest.

Now that keeping the metadata separate from the actual serialized data becomes common, it's unclear whether the Persisted case class still makes so much sense: we could skip creating an intermediate Persisted instance, and make separate methods on Persister to produce the manifest and the serialized data independently.

Persisters could be refactored to hold a Map[String, Persister] to look up persisters by manifest, which could make it much simpler and more efficient.

raboof added a commit that referenced this issue Oct 14, 2015
raboof added a commit that referenced this issue Oct 14, 2015
@agemooij
Copy link
Contributor

I briefly looked at your experiments with removing Persisted. Somehow it feels wrong to get rid of the symmetric relation between persist (i.e. T => Persisted) and unpersist (i.e. Persisted => T). The way you are going you don't have access to the "manifest" anymore after persisting. This might not be a problem but I liked the separation of concerns between the persister and the codec from the perspective of understanding the system and reasoning about it. My first instinct is that combining them makes it harder to reason about. I could be wrong of course. I'll have to think about it a bit more.

@raboof
Copy link
Member Author

raboof commented Oct 15, 2015

The idea is that persist would indeed become T => Array[Byte] instead of Persisted, I kept the current one around so I didn't have to rewrite all tests already :)

agemooij pushed a commit that referenced this issue Feb 19, 2016
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

No branches or pull requests

2 participants