/// <summary> /// Create a subscriptionId that is unique per grainId, grainType, namespace combination. /// </summary> /// <param name="grainId"></param> /// <param name="streamId"></param> /// <returns></returns> private Guid MakeSubscriptionGuid(GrainId grainId, StreamId streamId) { // first int in guid is grain type code int grainIdTypeCode = grainId.GetTypeCode(); return(MakeSubscriptionGuid(grainIdTypeCode, streamId)); }
public IGrainRegistrar GetRegistrarForGrain(GrainId grainId) { MultiClusterRegistrationStrategy strategy; var typeCode = grainId.GetTypeCode(); if (typeCode != 0) { string unusedGrainClass; PlacementStrategy unusedPlacement; this.grainTypeManager.GetTypeInfo(grainId.GetTypeCode(), out unusedGrainClass, out unusedPlacement, out strategy); } else { // special case for Membership grain or client grain. strategy = ClusterLocalRegistration.Singleton; // default } return(this.registrars[strategy.GetType()]); }
private void OnCollectActivation(GrainId grainId) { int other = grainId.GetTypeCode(); int self = Data.Address.Grain.GetTypeCode(); if (other == self) { IBusyActivationGcTestGrain1 g = GrainFactory.GetGrain<IBusyActivationGcTestGrain1>(grainId.GetPrimaryKey()); for (int i = 0; i < burstCount; ++i) { g.Delay(TimeSpan.FromMilliseconds(10)).Ignore(); } } }
/// <summary> /// Try to get the implicit subscriptionId. /// If an implicit subscription exists, return a subscription Id that is unique per grain type, grainId, namespace combination. /// </summary> /// <param name="grainId"></param> /// <param name="streamId"></param> /// <param name="subscriptionId"></param> /// <returns></returns> internal bool TryGetImplicitSubscriptionGuid(GrainId grainId, StreamId streamId, out Guid subscriptionId) { subscriptionId = Guid.Empty; if (!HasImplicitSubscription(streamId.Namespace, grainId.GetTypeCode())) { return(false); } // make subscriptionId subscriptionId = MakeSubscriptionGuid(grainId, streamId); return(true); }
private void OnCollectActivation(GrainId grainId) { int other = grainId.GetTypeCode(); int self = Data.Address.Grain.GetTypeCode(); if (other == self) { IBusyActivationGcTestGrain1 g = GrainFactory.GetGrain <IBusyActivationGcTestGrain1>(grainId.GetPrimaryKey()); for (int i = 0; i < burstCount; ++i) { g.Delay(TimeSpan.FromMilliseconds(10)).Ignore(); } } }
/// <summary> /// Determines whether the specified grain is an implicit subscriber of a given stream. /// </summary> /// <param name="grainId">The grain identifier.</param> /// <param name="streamId">The stream identifier.</param> /// <returns>true if the grain id describes an implicit subscriber of the stream described by the stream id.</returns> internal bool IsImplicitSubscriber(GrainId grainId, StreamId streamId) { return(HasImplicitSubscription(streamId.Namespace, grainId.GetTypeCode())); }
public DetailedGrainReport GetDetailedGrainReport(GrainId grain) { var report = new DetailedGrainReport { Grain = grain, SiloAddress = LocalSilo, SiloName = localSiloName, LocalCacheActivationAddresses = directory.GetLocalCacheData(grain), LocalDirectoryActivationAddresses = directory.GetLocalDirectoryData(grain), PrimaryForGrain = directory.GetPrimaryForGrain(grain) }; try { PlacementStrategy unused; string grainClassName; GrainTypeManager.GetTypeInfo(grain.GetTypeCode(), out grainClassName, out unused); report.GrainClassTypeName = grainClassName; } catch (Exception exc) { report.GrainClassTypeName = exc.ToString(); } List<ActivationData> acts = activations.FindTargets(grain); report.LocalActivations = acts != null ? acts.Select(activationData => activationData.ToDetailedString()).ToList() : new List<string>(); return report; }
public static void GetGrainTypeInfo(this IPlacementContext @this, GrainId grainId, out string grainClass, out PlacementStrategy placement, out MultiClusterRegistrationStrategy activationStrategy, string genericArguments = null) { @this.GetGrainTypeInfo(grainId.GetTypeCode(), out grainClass, out placement, out activationStrategy, genericArguments); }
public static string GetGrainTypeName(this IPlacementContext @this, GrainId grainId, string genericArguments = null) { return(@this.GetGrainTypeName(grainId.GetTypeCode(), genericArguments)); }
public static string SystemTargetName(GrainId id) { string name; if (singletonSystemTargetNames.TryGetValue(id, out name)) return name; if (nonSingletonSystemTargetNames.TryGetValue(id.GetTypeCode(), out name)) return name; return String.Empty; }
/// <summary> /// Try to get the implicit subscriptionId. /// If an implicit subscription exists, return a subscription Id that is unique per grain type, grainId, namespace combination. /// </summary> /// <param name="grainId"></param> /// <param name="streamId"></param> /// <param name="subscriptionId"></param> /// <returns></returns> internal bool TryGetImplicitSubscriptionGuid(GrainId grainId, StreamId streamId, out Guid subscriptionId) { subscriptionId = Guid.Empty; if (!HasImplicitSubscription(streamId.Namespace, grainId.GetTypeCode())) { return false; } // make subscriptionId subscriptionId = MakeSubscriptionGuid(grainId, streamId); return true; }
/// <summary> /// Determines whether the specified grain is an implicit subscriber of a given stream. /// </summary> /// <param name="grainId">The grain identifier.</param> /// <param name="streamId">The stream identifier.</param> /// <returns>true if the grain id describes an implicit subscriber of the stream described by the stream id.</returns> internal bool IsImplicitSubscriber(GrainId grainId, StreamId streamId) { return HasImplicitSubscription(streamId.Namespace, grainId.GetTypeCode()); }
/// <summary> /// Create a subscriptionId that is unique per grainId, grainType, namespace combination. /// </summary> /// <param name="grainId"></param> /// <param name="streamId"></param> /// <returns></returns> private Guid MakeSubscriptionGuid(GrainId grainId, StreamId streamId) { // first int in guid is grain type code int grainIdTypeCode = grainId.GetTypeCode(); return MakeSubscriptionGuid(grainIdTypeCode, streamId); }
public static void GetGrainTypeInfo(this IPlacementContext @this, GrainId grainId, out string grainClass, out PlacementStrategy placement, string genericArguments = null) { @this.GetGrainTypeInfo(grainId.GetTypeCode(), out grainClass, out placement, genericArguments); }
/// <summary> /// Determines whether the specified grain is an implicit subscriber of a given stream. /// </summary> /// <param name="grainId">The grain identifier.</param> /// <param name="streamId">The stream identifier.</param> /// <returns>true if the grain id describes an implicit subscriber of the stream described by the stream id.</returns> internal bool IsImplicitSubscriber(GrainId grainId, StreamId streamId) { if (String.IsNullOrWhiteSpace(streamId.Namespace)) { return(false); } HashSet <int> entry; return(table.TryGetValue(streamId.Namespace, out entry) && entry.Contains(grainId.GetTypeCode())); }
public IList<SiloAddress> GetCompatibleSiloList(GrainId grain) { var typeCode = grain.GetTypeCode(); var compatibleSilos = GrainTypeManager.GetSupportedSilos(typeCode).Intersect(AllActiveSilos).ToList(); if (compatibleSilos.Count == 0) throw new OrleansException($"TypeCode ${typeCode} not supported in the cluster"); return compatibleSilos; }
public static PlacementStrategy GetGrainPlacementStrategy(this IPlacementContext @this, GrainId grainId, string genericArguments = null) { return @this.GetGrainPlacementStrategy(grainId.GetTypeCode(), genericArguments); }
public static PlacementStrategy GetGrainPlacementStrategy(this IPlacementContext @this, GrainId grainId, string genericArguments = null) { return(@this.GetGrainPlacementStrategy(grainId.GetTypeCode(), genericArguments)); }
public static string GetGrainTypeName(this IPlacementContext @this, GrainId grainId, string genericArguments = null) { return @this.GetGrainTypeName(grainId.GetTypeCode(), genericArguments); }