private async Task processEventSlices(IShardAgent shardAgent, IAggregationRuntime <TDoc, TId> runtime, IDocumentStore store, CancellationToken token) { var beingFetched = new List <EventSlice <TDoc, TId> >(); foreach (var slice in Slices) { if (token.IsCancellationRequested) { _builder.Complete(); break; } if (runtime.IsNew(slice)) { _builder.Post(slice); } else { beingFetched.Add(slice); } } if (token.IsCancellationRequested) { return; } var ids = beingFetched.Select(x => x.Id).ToArray(); IReadOnlyList <TDoc> aggregates = null; await shardAgent.TryAction(async() => { var options = new SessionOptions { Tenant = Tenant, Tracking = DocumentTracking.None, AllowAnyTenant = true }; using var session = (IMartenSession)store.OpenSession(options); aggregates = await runtime.Storage .LoadManyAsync(ids, session, token).ConfigureAwait(false); }, token).ConfigureAwait(false); if (token.IsCancellationRequested || aggregates == null) { return; } var dict = aggregates.ToDictionary(x => runtime.Storage.Identity(x)); foreach (var slice in Slices) { if (dict.TryGetValue(slice.Id, out var aggregate)) { slice.Aggregate = aggregate; } _builder.Post(slice); } }
public override Task ConfigureUpdateBatch(IShardAgent shardAgent, ProjectionUpdateBatch batch, EventRangeGroup eventRangeGroup) { throw new System.NotImplementedException(); }
public override Task ConfigureUpdateBatch(IShardAgent shardAgent, ProjectionUpdateBatch batch, EventRangeGroup eventRangeGroup) { throw new NotSupportedException(); }
public abstract Task ConfigureUpdateBatch(IShardAgent shardAgent, ProjectionUpdateBatch batch, EventRangeGroup eventRangeGroup);