-
I noticed that theres a few functions in the API docs that are related to snapshots: https://reimagined.github.io/resolve/docs/api-reference#loadsnapshot Could you explain a little bit about the purpose of these and how to use them? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
These are low level methods that event store need to implement, app devs unlikely will call them. Snapshots are designed to be trasparent for you. Aggregate state is json built by running a projection function as a reducer on event stream. Next time aggregate state is built from snapshot forward, so building an aggregate state should read not more than N records from event store (including snapshot). N is 100 currently. If you change projection function, snapshot became unusable, so snapshots are marked by hash of projection function (this hash is calculated during reSolve build process). So if projection function is changed, snapshots will be rebuilt. The same mechanism is used for view models. |
Beta Was this translation helpful? Give feedback.
These are low level methods that event store need to implement, app devs unlikely will call them.
Snapshots are designed to be trasparent for you.
Aggregate state is json built by running a projection function as a reducer on event stream.
If number of events used is greater than N, aggregate state is saved to event store as a snapshot.
Next time aggregate state is built from snapshot forward, so building an aggregate state should read not more than N records from event store (including snapshot).
N is 100 currently.
If you change projection function, snapshot became unusable, so snapshots are marked by hash of projection function (this hash is calculated during reSolve build process). So…