Exemple #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());
 }
Exemple #2
0
        private bool GetUnordered()
        {
            if (RuntimeClient.Current == null)
            {
                return(false);
            }

            return(RuntimeClient.Current.GrainTypeResolver != null && RuntimeClient.Current.GrainTypeResolver.IsUnordered(GrainId.GetTypeCode()));
        }
Exemple #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));
 }
Exemple #4
0
 internal static GrainReference NewObserverGrainReference(GrainId grainId, GuidId observerId)
 {
     return(new GrainReference(grainId, null, null, observerId));
 }
 private ActivationAddress(SiloAddress silo, GrainId grain, ActivationId activation)
 {
     Silo       = silo;
     Grain      = grain;
     Activation = activation;
 }
        public static ActivationAddress NewActivationAddress(SiloAddress silo, GrainId grain)
        {
            var activation = ActivationId.NewId();

            return(GetAddress(silo, grain, activation));
        }
Exemple #7
0
 public static bool IsSystemGrain(GrainId grain)
 {
     return(systemGrainNames.ContainsKey(grain));
 }
Exemple #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());
        }
Exemple #9
0
 public static bool TryGetSystemGrainName(GrainId id, out string name)
 {
     return(systemGrainNames.TryGetValue(id, out name));
 }
Exemple #10
0
 public static bool IsSingletonSystemTarget(GrainId id)
 {
     return(singletonSystemTargetNames.ContainsKey(id));
 }
Exemple #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));
 }
Exemple #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());
 }
Exemple #13
0
 // For white-box testing only
 internal int UnregisterGrainForTesting(GrainId grain)
 {
     return(silo.catalog.UnregisterGrainForTesting(grain));
 }