Пример #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));
 }