-
Notifications
You must be signed in to change notification settings - Fork 4
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
[POC] Add snapshots #30
Conversation
@krzysztofreczek I took a look at the implementation and the idea is brilliant in its simplicity. However, I would prefer to have a separate interface for the snapshot event, something like:
This would definitely save me confusion and make the API a bit more intuitive in case you read the code for the first time. At the same time, the implementation would be more robust. With the current approach, you allow to do weird things (see the code below) because from the domain perspective there is no difference between events and snapshots.
|
@kamy22 , @m110 also pointed that out. Thank You. I will try to separate Snapshots from Events somehow. 👍 |
@krzysztofreczek LGTM 💪 |
@vinitius JFYI, there will be snapshots in esja <3 |
Here is a POC proposal for support of snapshots.
The Idea:
I introduced an optional interface that informs that the Entity supports snapshots:
The snapshot is just an interface that devs will need to implement.
As part of the event store implementation, I started with an
in-memory
event store, and it could be later easily propagated to other databases. The idea is pretty simple:Testing:
I created a new
_example
with aCounter
entity to prove the POC works.Here it is visible how simple it is to implement the snapshot support: