Beispiel #1
0
        internal override GrainReference GetNextBucket(out IIndexInterface <K, V> nextBucketIndexInterface)
        {
            var nextBucket = GrainFactory.GetGrain <TotalHashIndexPartitionedPerKeyBucketImplTransactional <K, V> >(IndexUtils.GetNextIndexBucketIdInChain(this.AsWeaklyTypedReference()));

            nextBucketIndexInterface = nextBucket;
            return(nextBucket.AsWeaklyTypedReference());
        }
Beispiel #2
0
        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.Lookup(this._param));
        }
        internal override GrainReference GetNextBucket(out IIndexInterface <K, V> nextBucketIndexInterface)
        {
            var nextBucket = GrainFactory.GetGrain <ITotalHashIndexSingleBucket <K, V> >(IndexUtils.GetNextIndexBucketIdInChain(this.AsWeaklyTypedReference()));

            nextBucketIndexInterface = nextBucket;
            return(nextBucket.AsWeaklyTypedReference());
        }
Beispiel #4
0
        private async Task <IIndexInterface <K, V> > GetNextBucketAndPersist()
        {
            IIndexInterface <K, V> nextBucket = GetNextBucket();

            await PersistIndex();

            return(nextBucket);
        }
Beispiel #5
0
        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
            await index.Lookup(result.Cast <IIndexableGrain>(), this._param);
        }
 /// <summary>
 /// An extension method to intercept the calls to DirectApplyIndexUpdate on an Index,
 /// so that for a PerSilo index, it can obtain the GrainService of that index on the silo of the indexed grain.
 /// </summary>
 internal static Task <bool> ApplyIndexUpdate(this IIndexInterface index, SiloIndexManager siloIndexManager,
                                              IIndexableGrain updatedGrain, Immutable <IMemberUpdate> update,
                                              IndexMetaData idxMetaData, SiloAddress siloAddress = null)
 {
     if (index is IActiveHashIndexPartitionedPerSilo)
     {
         var bucketInCurrentSilo = siloIndexManager.GetGrainService <IActiveHashIndexPartitionedPerSiloBucket>(
             GetAHashIndexPartitionedPerSiloGrainReference(siloIndexManager,
                                                           IndexUtils.GetIndexNameFromIndexGrain((IAddressable)index), index.GetType().GetGenericArguments()[1],
                                                           siloAddress
                                                           ));
         return(bucketInCurrentSilo.DirectApplyIndexUpdate(updatedGrain, update, idxMetaData.IsUniqueIndex, idxMetaData /*, siloAddress*/));
     }
     return(index.DirectApplyIndexUpdate(updatedGrain, update, idxMetaData.IsUniqueIndex, idxMetaData, siloAddress));
 }
 internal IndexInfo(IIndexInterface indexInterface, IndexMetaData metaData, IIndexUpdateGenerator updateGenerator)
 {
     this.IndexInterface  = indexInterface;
     this.MetaData        = metaData;
     this.UpdateGenerator = updateGenerator;
 }