Ejemplo n.º 1
0
        /// <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 = LegacyGrainId.FromGrainId(grainId).TypeCode;

            return(MakeSubscriptionGuid(grainIdTypeCode, streamId));
        }
Ejemplo n.º 2
0
 /// <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(grainId.IsLegacyGrain() && HasImplicitSubscription(streamId.Namespace, LegacyGrainId.FromGrainId(grainId).TypeCode));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns the string primary key of the grain.
 /// </summary>
 /// <param name="grain">The grain to find the primary key for.</param>
 /// <returns>A string representing the primary key for this grain.</returns>
 public static string GetPrimaryKeyString(this IAddressable grain)
 {
     return(LegacyGrainId.FromGrainId(GetGrainId(grain)).GetPrimaryKeyString());
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Returns the Guid representation of a grain primary key.
 /// </summary>
 /// <param name="grain">The grain to find the primary key for.</param>
 /// <returns>A Guid representing the primary key for this grain.</returns>
 public static Guid GetPrimaryKey(this IAddressable grain) => LegacyGrainId.FromGrainId(GetGrainId(grain)).GetPrimaryKey();
Ejemplo n.º 5
0
 /// <summary>
 /// Returns the Guid representation of a grain primary key.
 /// </summary>
 /// <param name="grain">The grain to find the primary key for.</param>
 /// <param name="keyExt">The output parameter to return the extended key part of the grain primary key, if extended primary key was provided for that grain.</param>
 /// <returns>A Guid representing the primary key for this grain.</returns>
 public static Guid GetPrimaryKey(this IAddressable grain, out string keyExt) => LegacyGrainId.FromGrainId(GetGrainId(grain)).GetPrimaryKey(out keyExt);
Ejemplo n.º 6
0
 /// <summary>
 /// Returns the long representation of a grain primary key.
 /// </summary>
 /// <param name="grain">The grain to find the primary key for.</param>
 /// <returns>A long representing the primary key for this grain.</returns>
 public static long GetPrimaryKeyLong(this IAddressable grain) => LegacyGrainId.FromGrainId(GetGrainId(grain)).GetPrimaryKeyLong();
Ejemplo n.º 7
0
 /// <summary>
 /// Returns whether part of the primary key is of type long.
 /// </summary>
 /// <param name="grain">The target grain.</param>
 public static bool IsPrimaryKeyBasedOnLong(this IAddressable grain)
 {
     return(LegacyGrainId.FromGrainId(GetGrainId(grain)).IsLongKey);
 }