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.
Description
This adds snapshot capability to eventstore and aggregatestore. With given strategy saves a snapshot of aggregate and loads next time and remaining events wich can increase load times of long-living aggregates
Affected Components
Related Issues
None
Solution and Design
A eventstore implemtation can now implement
eh.SnapshotStore
an now store snaphots of current state in aggregate.every aggregate that want to be snapshotted needs to implement
eh.Snapshotable
Loading
When aggretate i requested to be loaded the store checks if aggretate implements
eh.Snapshotable
and tries to find latest snapshot for aggregate. Loads and applies snapshot then loads all events that is not applies in current snapshot.Saving
When aggretate i requested to be saved the store checks if aggretate implements
eh.Snapshotable
and if the strategy return true we create a snapshot ans saves it alongside the events.Steps to test and verify
EveryNumberEventSnapshotStrateg
<- set to every 1PeriodSnapshotStrategy
NoSnapshotStrategy
ehSnapshotable
in longliving aggregate