You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're currently preparing to add snapshots to our projects, it's not implemented yet in Castore.
We are planning on implementing something similar to:
publicasyncgetAggregate(id: string): Promise<AGGREGATE_CLASS|undefined>{constsnapshot: {version: number,aggregateState: $AGGREGATE}|undefined=awaitthis.getSnapshot(id);constversion=snapshot ? snapshot.version : 0;constaggregateState=snapshot ? snapshot.aggregateState : {}as$AGGREGATE;const{events}=awaitthis.castoreEventStore.getEvents(id,{minVersion: version||0});// cast to any because it's not typed correctly EVENT_DETAIL[] vs $EVENT_DETAIL[]constaggregate=this.castoreEventStore.buildAggregate(eventsasany,aggregateState);if(aggregate===undefined){returnundefined;}// this create an AggregateClass from the statereturnthis.factory(aggregate);}
Where snapshots are stored listening to StateCarryingEvents.
But my main concern is about snapshot invalidations, If you have any recommendations for that?
We are also considering adding an AggregateReducerVersion in our class (that we could increment manually) to invalidate snapshots built with another reducer, but it seems tricky to maintain something like that manually.
Do you already have some idea of the future implementation of snapshots in Castore we could take inspiration on?
What have been the issues you were facing implementing it in the past?
The text was updated successfully, but these errors were encountered:
Hey,
We're currently preparing to add snapshots to our projects, it's not implemented yet in Castore.
We are planning on implementing something similar to:
Where snapshots are stored listening to StateCarryingEvents.
But my main concern is about snapshot invalidations, If you have any recommendations for that?
We are also considering adding an AggregateReducerVersion in our class (that we could increment manually) to invalidate snapshots built with another reducer, but it seems tricky to maintain something like that manually.
Do you already have some idea of the future implementation of snapshots in Castore we could take inspiration on?
What have been the issues you were facing implementing it in the past?
The text was updated successfully, but these errors were encountered: