本文整理汇总了C#中GrainId.GetTypeCode方法的典型用法代码示例。如果您正苦于以下问题:C# GrainId.GetTypeCode方法的具体用法?C# GrainId.GetTypeCode怎么用?C# GrainId.GetTypeCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrainId
的用法示例。
在下文中一共展示了GrainId.GetTypeCode方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCollectActivation
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();
}
}
}
示例2: GetDetailedGrainReport
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;
}
示例3: GetGrainTypeInfo
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);
}
示例4: GetGrainTypeName
public static string GetGrainTypeName(this IPlacementContext @this, GrainId grainId, string genericArguments = null)
{
return @this.GetGrainTypeName(grainId.GetTypeCode(), genericArguments);
}
示例5: GetGrainPlacementStrategy
public static PlacementStrategy GetGrainPlacementStrategy(this IPlacementContext @this, GrainId grainId, string genericArguments = null)
{
return @this.GetGrainPlacementStrategy(grainId.GetTypeCode(), genericArguments);
}
示例6: GetCompatibleSiloList
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;
}
示例7: TryGetImplicitSubscriptionGuid
/// <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;
}
示例8: IsImplicitSubscriber
/// <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());
}
示例9: MakeSubscriptionGuid
/// <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);
}
示例10: GetGrainTypeInfo
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);
}