public override async Task <IOrleansQueryResult <TIGrain> > GetResults() { IIndexInterface index = base.IndexFactory.GetIndex(typeof(TIGrain), this._indexName); //the actual lookup for the query result to be streamed to the observer return((IOrleansQueryResult <TIGrain>)await(index is ITransactionalLookupIndex transactionalLookupIndex ? transactionalLookupIndex.LookupTransactionalAsync(this._param) : index.LookupAsync(this._param))); }
public override async Task ObserveResults(IAsyncBatchObserver <TIGrain> observer) { IIndexInterface index = base.IndexFactory.GetIndex(typeof(TIGrain), this._indexName); IAsyncStream <TIGrain> resultStream = base.StreamProvider.GetStream <TIGrain>(Guid.NewGuid(), IndexUtils.GetIndexGrainPrimaryKey(typeof(TIGrain), this._indexName)); IOrleansQueryResultStream <TIGrain> result = new OrleansQueryResultStream <TIGrain>(resultStream); //the observer is attached to the query result await result.SubscribeAsync(observer); //the actual lookup for the query result to be streamed to the observer var castResult = result.Cast <IIndexableGrain>(); await(index is ITransactionalLookupIndex transactionalLookupIndex ? transactionalLookupIndex.LookupTransactionalAsync(castResult, this._param) : index.LookupAsync(castResult, this._param)); }