public async Task <ISnapshot?> GenerateAsync( CancellationToken?cancellationToken = default, ulong?target = default) { IEventReconciler reconciler = CreateEventReconciler( out Func <Task <IEnumerable <EventCentricAggregateRoot> > > aggregates); ulong?current = await reconciler .ReconcileAsync( cancellationToken : cancellationToken, target : target) .ConfigureAwait(false); if (current.HasValue) { var sequence = new EventSequence(current.Value); IEnumerable <EventCentricAggregateRoot> values = await aggregates() .ConfigureAwait(false); return(new Snapshot(values, sequence)); } return(default);
private void ReconcileEvents(IEventSequence?previous, IEventSequence?target) { _ = eventReconciler.ReconcileAsync(previous: previous?.Sequence, target: target?.Sequence); }