Ejemplo n.º 1
0
        public static IIndexWorkflowQueue GetIndexWorkflowQueueFromGrainHashCode(SiloIndexManager siloIndexManager, Type grainInterfaceType, int grainHashCode, SiloAddress siloAddress)
        {
            int queueSeqNum    = StorageProviderUtils.PositiveHash(grainHashCode, siloIndexManager.NumWorkflowQueuesPerInterface);
            var grainReference = CreateGrainServiceGrainReference(siloIndexManager, grainInterfaceType, queueSeqNum, siloAddress);

            return(siloIndexManager.GetGrainService <IIndexWorkflowQueue>(grainReference));
        }
 /// <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));
 }
Ejemplo n.º 3
0
 private IIndexWorkflowQueue InitIndexWorkflowQueue()
 => __workflowQueue = _lazyParent.Value.IsGrainService
             ? _siloIndexManager.GetGrainService <IIndexWorkflowQueue>(IndexWorkflowQueueBase.CreateIndexWorkflowQueueGrainReference(_siloIndexManager, _grainInterfaceType, _queueSeqNum, _silo))
             : _siloIndexManager.GrainFactory.GetGrain <IIndexWorkflowQueue>(IndexWorkflowQueueBase.CreateIndexWorkflowQueuePrimaryKey(_grainInterfaceType, _queueSeqNum));
Ejemplo n.º 4
0
 private IIndexWorkflowQueueHandler InitWorkflowQueueHandler()
 => __handler = _lazyParent.Value.IsGrainService
         ? SiloIndexManager.GetGrainService <IIndexWorkflowQueueHandler>(
     IndexWorkflowQueueHandlerBase.CreateIndexWorkflowQueueHandlerGrainReference(SiloIndexManager, _grainInterfaceType, _queueSeqNum, _silo))
         : SiloIndexManager.GrainFactory.GetGrain <IIndexWorkflowQueueHandler>(CreateIndexWorkflowQueuePrimaryKey(_grainInterfaceType, _queueSeqNum));