コード例 #1
0
        public static ActivationAddress GetAddress(SiloAddress silo, GrainId grain, ActivationId activation, MultiClusterStatus status = MultiClusterStatus.Owned)
        {
            // Silo part is not mandatory
            if (grain == null) throw new ArgumentNullException("grain");

            return new ActivationAddress(silo, grain, activation, status);
        }
コード例 #2
0
 private ActivationAddress(SiloAddress silo, GrainId grain, ActivationId activation, MultiClusterStatus status)
 {
     Silo = silo;
     Grain = grain;
     Activation = activation;
     Status = status;
 }
コード例 #3
0
 private ActivationAddress(SiloAddress silo, GrainId grain, ActivationId activation, MultiClusterStatus status)
 {
     Silo       = silo;
     Grain      = grain;
     Activation = activation;
     Status     = status;
 }
コード例 #4
0
        public bool UpdateClusterRegistrationStatus(ActivationId activationId, MultiClusterStatus status, MultiClusterStatus?compareWith = null)
        {
            IActivationInfo activationInfo;

            if (!Instances.TryGetValue(activationId, out activationInfo))
            {
                return(false);
            }
            if (compareWith.HasValue && compareWith.Value != activationInfo.RegistrationStatus)
            {
                return(false);
            }
            activationInfo.RegistrationStatus = status;
            return(true);
        }
コード例 #5
0
 public ActivationAddress AddSingleActivation(GrainId grain, ActivationId act, SiloAddress silo, MultiClusterStatus registrationStatus = MultiClusterStatus.Owned)
 {
     SingleInstance = true;
     if (Instances.Count > 0)
     {
         var item = Instances.First();
         return ActivationAddress.GetAddress(item.Value.SiloAddress, grain, item.Key);
     }
     else
     {
         Instances.Add(act, new ActivationInfo(silo, registrationStatus));
         VersionTag = rand.Next();
         return ActivationAddress.GetAddress(silo, grain, act, registrationStatus);
     }
 }
コード例 #6
0
 public ActivationAddress AddSingleActivation(GrainId grain, ActivationId act, SiloAddress silo, MultiClusterStatus registrationStatus = MultiClusterStatus.Owned)
 {
     SingleInstance = true;
     if (Instances.Count > 0)
     {
         var item = Instances.First();
         return(ActivationAddress.GetAddress(item.Value.SiloAddress, grain, item.Key));
     }
     else
     {
         Instances.Add(act, new ActivationInfo(silo, registrationStatus));
         VersionTag = rand.Next();
         return(ActivationAddress.GetAddress(silo, grain, act, registrationStatus));
     }
 }
コード例 #7
0
 public bool UpdateClusterRegistrationStatus(GrainId grain, ActivationId activationId, MultiClusterStatus registrationStatus, MultiClusterStatus?compareWith = null)
 {
     lock (lockable)
     {
         if (partitionData.ContainsKey(grain))
         {
             return(partitionData[grain].UpdateClusterRegistrationStatus(activationId, registrationStatus, compareWith));
         }
         return(false);
     }
 }
コード例 #8
0
        /// <summary>
        /// Adds a new activation to the directory partition
        /// </summary>
        /// <param name="grain"></param>
        /// <param name="activation"></param>
        /// <param name="silo"></param>
        /// <param name="registrationStatus"></param>
        /// <returns>The registered ActivationAddress and version associated with this directory mapping</returns>
        internal virtual AddressAndTag AddSingleActivation(GrainId grain, ActivationId activation, SiloAddress silo, MultiClusterStatus registrationStatus = MultiClusterStatus.Owned)
        {
            if (log.IsVerbose3)
            {
                log.Verbose3("Adding single activation for grain {0}{1}{2}", silo, grain, activation);
            }

            AddressAndTag result = new AddressAndTag();

            if (!IsValidSilo(silo))
            {
                return(result);
            }

            lock (lockable)
            {
                if (!partitionData.ContainsKey(grain))
                {
                    partitionData[grain] = new GrainInfo();
                }
                var grainInfo = partitionData[grain];
                result.Address    = grainInfo.AddSingleActivation(grain, activation, silo, registrationStatus);
                result.VersionTag = grainInfo.VersionTag;
            }
            return(result);
        }
コード例 #9
0
 public ActivationInfo(IActivationInfo iActivationInfo)
 {
     SiloAddress        = iActivationInfo.SiloAddress;
     TimeCreated        = iActivationInfo.TimeCreated;
     RegistrationStatus = iActivationInfo.RegistrationStatus;
 }
コード例 #10
0
 public ActivationInfo(SiloAddress siloAddress, MultiClusterStatus registrationStatus)
 {
     SiloAddress        = siloAddress;
     TimeCreated        = DateTime.UtcNow;
     RegistrationStatus = registrationStatus;
 }
コード例 #11
0
 public bool UpdateClusterRegistrationStatus(GrainId grain, ActivationId activationId, MultiClusterStatus registrationStatus, MultiClusterStatus? compareWith = null)
 {
     lock (lockable)
     {
         if (partitionData.ContainsKey(grain))
         {
             return partitionData[grain].UpdateClusterRegistrationStatus(activationId, registrationStatus, compareWith);
         }
         return false;
     }
 }
コード例 #12
0
        /// <summary>
        /// Adds a new activation to the directory partition
        /// </summary>
        /// <param name="grain"></param>
        /// <param name="activation"></param>
        /// <param name="silo"></param>
        /// <param name="registrationStatus"></param>
        /// <returns>The registered ActivationAddress and version associated with this directory mapping</returns>
        internal virtual AddressAndTag AddSingleActivation(GrainId grain, ActivationId activation, SiloAddress silo, MultiClusterStatus registrationStatus = MultiClusterStatus.Owned)
        {
            if (log.IsVerbose3) log.Verbose3("Adding single activation for grain {0}{1}{2}", silo, grain, activation);

            AddressAndTag result = new AddressAndTag();

            if (!IsValidSilo(silo))
                return result;
            
            lock (lockable)
            {
                if (!partitionData.ContainsKey(grain))
                {
                    partitionData[grain] = new GrainInfo();
                }
                var grainInfo = partitionData[grain];
                result.Address = grainInfo.AddSingleActivation(grain, activation, silo, registrationStatus);
                result.VersionTag = grainInfo.VersionTag;
            }
            return result;
        }
コード例 #13
0
 public ActivationInfo(IActivationInfo iActivationInfo)
 {
     SiloAddress = iActivationInfo.SiloAddress;
     TimeCreated = iActivationInfo.TimeCreated;
     RegistrationStatus = iActivationInfo.RegistrationStatus;
 }
コード例 #14
0
 public bool UpdateClusterRegistrationStatus(ActivationId activationId, MultiClusterStatus status, MultiClusterStatus? compareWith = null)
 {
     IActivationInfo activationInfo;
     if (!Instances.TryGetValue(activationId, out activationInfo))
         return false;
     if (compareWith.HasValue && compareWith.Value != activationInfo.RegistrationStatus)
         return false;
     activationInfo.RegistrationStatus = status;
     return true;
 }
コード例 #15
0
 public ActivationInfo(SiloAddress siloAddress, MultiClusterStatus registrationStatus)
 {
     SiloAddress = siloAddress;
     TimeCreated = DateTime.UtcNow;
     RegistrationStatus = registrationStatus;
 }
コード例 #16
0
        public static ActivationAddress GetAddress(SiloAddress silo, GrainId grain, ActivationId activation, MultiClusterStatus status = MultiClusterStatus.Owned)
        {
            // Silo part is not mandatory
            if (grain == null)
            {
                throw new ArgumentNullException("grain");
            }

            return(new ActivationAddress(silo, grain, activation, status));
        }