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); }
private ActivationAddress(SiloAddress silo, GrainId grain, ActivationId activation, MultiClusterStatus status) { Silo = silo; Grain = grain; Activation = activation; Status = status; }
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); }
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); } }
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)); } }
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); } }
/// <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); }
public ActivationInfo(IActivationInfo iActivationInfo) { SiloAddress = iActivationInfo.SiloAddress; TimeCreated = iActivationInfo.TimeCreated; RegistrationStatus = iActivationInfo.RegistrationStatus; }
public ActivationInfo(SiloAddress siloAddress, MultiClusterStatus registrationStatus) { SiloAddress = siloAddress; TimeCreated = DateTime.UtcNow; RegistrationStatus = registrationStatus; }
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; } }
/// <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; }
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; }
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)); }