INTERNAL API Data structure for picking heartbeat receivers. The node ring is shuffled by deterministic hashing to avoid picking physically co-located neighbors. It is immutable, i.e. the methods all return new instances.
Esempio n. 1
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="ring">TBD</param>
 /// <param name="oldReceiversNowUnreachable">TBD</param>
 /// <param name="failureDetector">TBD</param>
 public ClusterHeartbeatSenderState(HeartbeatNodeRing ring, ImmutableHashSet <UniqueAddress> oldReceiversNowUnreachable, IFailureDetectorRegistry <Address> failureDetector)
 {
     Ring = ring;
     OldReceiversNowUnreachable = oldReceiversNowUnreachable;
     FailureDetector            = failureDetector;
     ActiveReceivers            = Ring.MyReceivers.Value.Union(OldReceiversNowUnreachable);
 }
Esempio n. 2
0
        private ClusterHeartbeatSenderState MembershipChange(HeartbeatNodeRing newRing)
        {
            var oldReceivers     = Ring.MyReceivers.Value;
            var removedReceivers = oldReceivers.Except(newRing.MyReceivers.Value);
            var adjustedOldReceiversNowUnreachable = OldReceiversNowUnreachable;

            foreach (var r in removedReceivers)
            {
                if (FailureDetector.IsAvailable(r.Address))
                {
                    FailureDetector.Remove(r.Address);
                }
                else
                {
                    adjustedOldReceiversNowUnreachable = adjustedOldReceiversNowUnreachable.Add(r);
                }
            }
            return(Copy(newRing, adjustedOldReceiversNowUnreachable));
        }
Esempio n. 3
0
 private ClusterHeartbeatSenderState MembershipChange(HeartbeatNodeRing newRing)
 {
     var oldReceivers = Ring.MyReceivers.Value;
     var removedReceivers = oldReceivers.Except(newRing.MyReceivers.Value);
     var newUnreachable = Unreachable;
     foreach (var r in removedReceivers)
     {
         if (FailureDetector.IsAvailable(r.Address))
             FailureDetector.Remove(r.Address);
         else
         {
             newUnreachable = newUnreachable.Add(r);
         }
     }
     return Copy(newRing, newUnreachable);
 }
Esempio n. 4
0
 public ClusterHeartbeatSenderState Copy(HeartbeatNodeRing ring = null, ImmutableHashSet<UniqueAddress> unreachable = null, IFailureDetectorRegistry<Address> failureDetector = null)
 {
     return new ClusterHeartbeatSenderState(ring ?? Ring, unreachable ?? Unreachable, failureDetector ?? FailureDetector);
 }
Esempio n. 5
0
 public ClusterHeartbeatSenderState(HeartbeatNodeRing ring, ImmutableHashSet<UniqueAddress> unreachable, IFailureDetectorRegistry<Address> failureDetector)
 {
     FailureDetector = failureDetector;
     Unreachable = unreachable;
     Ring = ring;
     ActiveReceivers = Ring.MyReceivers.Value.Union(Unreachable);
 }
Esempio n. 6
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="ring">TBD</param>
 /// <param name="oldReceiversNowUnreachable">TBD</param>
 /// <param name="failureDetector">TBD</param>
 /// <returns>TBD</returns>
 public ClusterHeartbeatSenderState Copy(HeartbeatNodeRing ring = null, ImmutableHashSet <UniqueAddress> oldReceiversNowUnreachable = null, IFailureDetectorRegistry <Address> failureDetector = null)
 {
     return(new ClusterHeartbeatSenderState(ring ?? Ring, oldReceiversNowUnreachable ?? OldReceiversNowUnreachable, failureDetector ?? FailureDetector));
 }