/// <summary>
 /// Must be overridden to use as an async projection. Takes a range of events, and sorts them
 /// into an EventSlice for each detected aggregate document
 /// </summary>
 /// <param name="store"></param>
 /// <param name="database"></param>
 /// <param name="range"></param>
 /// <param name="cancellation"></param>
 /// <returns></returns>
 /// <exception cref="NotSupportedException"></exception>
 public ValueTask <IReadOnlyList <TenantSliceGroup <TDoc, TId> > > GroupEventRange(DocumentStore store,
                                                                                   IMartenDatabase database,
                                                                                   EventRange range, CancellationToken cancellation)
 {
     using var session = store.OpenSession(SessionOptions.ForDatabase(database));
     return(Slicer.SliceAsyncEvents(session, range.Events));
 }
Example #2
0
        public async ValueTask <EventRangeGroup> GroupEvents(DocumentStore store, EventRange range, CancellationToken cancellationToken)
        {
            IReadOnlyList <TenantSliceGroup <TDoc, TId> > groups;

            using (var session = store.QuerySession())
            {
                groups = await Slicer.SliceAsyncEvents(session, range.Events, store.Tenancy).ConfigureAwait(false);
            }

            return(new TenantSliceRange <TDoc, TId>(store, this, range, groups, cancellationToken));
        }