示例#1
0
 /// <summary>Get a uniform hash code for this grain reference.</summary>
 public uint GetUniformHashCode()
 {
     // GrainId already includes the hashed type code for generic arguments.
     return(GrainId.GetUniformHashCode());
 }
示例#2
0
        private bool GetUnordered()
        {
            if (RuntimeClient.Current == null)
            {
                return(false);
            }

            return(RuntimeClient.Current.GrainTypeResolver != null && RuntimeClient.Current.GrainTypeResolver.IsUnordered(GrainId.GetTypeCode()));
        }
示例#3
0
 /// <summary>
 /// Constructs a reference to the grain with the specified ID.
 /// </summary>
 /// <param name="grainId">The ID of the grain to refer to.</param>
 internal static GrainReference FromGrainId(GrainId grainId, string genericArguments = null, SiloAddress systemTargetSilo = null)
 {
     return(new GrainReference(grainId, genericArguments, systemTargetSilo, null));
 }
示例#4
0
 internal static GrainReference NewObserverGrainReference(GrainId grainId, GuidId observerId)
 {
     return(new GrainReference(grainId, null, null, observerId));
 }
示例#5
0
 private ActivationAddress(SiloAddress silo, GrainId grain, ActivationId activation)
 {
     Silo       = silo;
     Grain      = grain;
     Activation = activation;
 }
示例#6
0
        public static ActivationAddress NewActivationAddress(SiloAddress silo, GrainId grain)
        {
            var activation = ActivationId.NewId();

            return(GetAddress(silo, grain, activation));
        }
示例#7
0
 public static bool IsSystemGrain(GrainId grain)
 {
     return(systemGrainNames.ContainsKey(grain));
 }
示例#8
0
        public HostedClient(
            IRuntimeClient runtimeClient,
            ClientObserverRegistrar clientObserverRegistrar,
            ILocalSiloDetails siloDetails,
            ILogger <HostedClient> logger,
            IGrainReferenceRuntime grainReferenceRuntime,
            IInternalGrainFactory grainFactory,
            InvokableObjectManager invokableObjectManager,
            ISiloMessageCenter messageCenter)
        {
            this.runtimeClient           = runtimeClient;
            this.clientObserverRegistrar = clientObserverRegistrar;
            this.grainReferenceRuntime   = grainReferenceRuntime;
            this.grainFactory            = grainFactory;
            this.invokableObjects        = invokableObjectManager;
            this.siloMessageCenter       = messageCenter;
            this.logger = logger;

            this.siloMessageCenter.SetHostedClient(this);
            this.ClientAddress = ActivationAddress.NewActivationAddress(siloDetails.SiloAddress, GrainId.NewClientId());
        }
示例#9
0
 public static bool TryGetSystemGrainName(GrainId id, out string name)
 {
     return(systemGrainNames.TryGetValue(id, out name));
 }
示例#10
0
 public static bool IsSingletonSystemTarget(GrainId id)
 {
     return(singletonSystemTargetNames.ContainsKey(id));
 }
示例#11
0
 /// <summary> Get the key value for this grain, as a string. </summary>
 public string ToKeyString()
 {
     return(String.IsNullOrEmpty(genericArguments) ?
            String.Format("{0}={1}", GRAIN_REFERENCE_STR, GrainId.ToParsableString()) :
            String.Format("{0}={1} {2}={3}", GRAIN_REFERENCE_STR, GrainId.ToParsableString(), GENERIC_ARGUMENTS_STR, genericArguments));
 }
示例#12
0
 /// <summary> Calculates a hash code for a grain reference. </summary>
 public override int GetHashCode()
 {
     return(SystemTargetSilo == null?GrainId.GetHashCode() : GrainId.GetHashCode() ^ SystemTargetSilo.GetHashCode());
 }
示例#13
0
 // For white-box testing only
 internal int UnregisterGrainForTesting(GrainId grain)
 {
     return(silo.catalog.UnregisterGrainForTesting(grain));
 }