Immutable data structure that holds the reachability status of subject nodes as seen from observer nodes. Failure detector for the subject nodes exist on the observer nodes. Changes (reachable, unreachable, terminated) are only performed by observer nodes to its own records. Each change bumps the version number of the record, and thereby it is always possible to determine which record is newest merging two instances. Aggregated status of a subject node is defined as (in this order): - Terminated if any observer node considers it as Terminated - Unreachable if any observer node considers it as Unreachable - Reachable otherwise, i.e. no observer node considers it as Unreachable
コード例 #1
0
ファイル: ClusterReadView.cs プロジェクト: Micha-kun/akka.net
        public ClusterReadView(Cluster cluster)
        {
            _cluster = cluster;
            _state = new ClusterEvent.CurrentClusterState();
            _reachability = Reachability.Empty;
            _latestStats = new ClusterEvent.CurrentInternalStats(new GossipStats(), new VectorClockStats());
            _selfAddress = cluster.SelfAddress;

            _eventBusListener =
                cluster.System.SystemActorOf(
                    Props.Create(() => new EventBusListener(cluster, this))
                        .WithDispatcher(cluster.Settings.UseDispatcher)
                        .WithDeploy(Deploy.Local), "clusterEventBusListener");
        }
コード例 #2
0
 public ReachabilityChanged(Reachability reachability)
 {
     _reachability = reachability;
 }
コード例 #3
0
ファイル: Reachability.cs プロジェクト: rogeralsing/akka.net
        public Reachability Merge(IEnumerable<UniqueAddress> allowed, Reachability other)
        {
            var recordBuilder = ImmutableList.CreateBuilder<Record>();
            //TODO: Size hint somehow?
            var newVersions = _versions;
            foreach (var observer in allowed)
            {
                var observerVersion1 = CurrentVersion(observer);
                var observerVersion2 = other.CurrentVersion(observer);

                var rows1 = ObserverRows(observer);
                var rows2 = other.ObserverRows(observer);

                if (rows1 != null && rows2 != null)
                {
                    var rows = observerVersion1 > observerVersion2 ? rows1 : rows2;
                    foreach(var record in rows.Values.Where(r => allowed.Contains(r.Subject)))
                        recordBuilder.Add(record);
                }
                if (rows1 != null && rows2 == null)
                {
                    if(observerVersion1 > observerVersion2)
                        foreach (var record in rows1.Values.Where(r => allowed.Contains(r.Subject)))
                            recordBuilder.Add(record);
                }
                if (rows1 == null && rows2 != null)
                {
                    if (observerVersion2 > observerVersion1)
                        foreach (var record in rows2.Values.Where(r => allowed.Contains(r.Subject)))
                           recordBuilder.Add(record);
                }

                if (observerVersion2 > observerVersion1)
                    newVersions = newVersions.SetItem(observer, observerVersion2);
            }

            newVersions = ImmutableDictionary.CreateRange(newVersions.Where(p => allowed.Contains(p.Key)));

            return new Reachability(recordBuilder.ToImmutable(), newVersions);
        }
コード例 #4
0
 public ReachabilityChanged(Reachability reachability)
 {
     _reachability = reachability;
 }
コード例 #5
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="seen">TBD</param>
 /// <param name="reachability">TBD</param>
 /// <returns>TBD</returns>
 public GossipOverview Copy(ImmutableHashSet <UniqueAddress> seen = null, Reachability reachability = null)
 {
     return(new GossipOverview(seen ?? _seen, reachability ?? _reachability));
 }
コード例 #6
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="seen">TBD</param>
 /// <param name="reachability">TBD</param>
 public GossipOverview(ImmutableHashSet <UniqueAddress> seen, Reachability reachability)
 {
     _seen         = seen;
     _reachability = reachability;
 }
コード例 #7
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="reachability">TBD</param>
 public GossipOverview(Reachability reachability) : this(ImmutableHashSet.Create <UniqueAddress>(), reachability)
 {
 }
コード例 #8
0
ファイル: Gossip.cs プロジェクト: Micha-kun/akka.net
 public GossipOverview Copy(ImmutableHashSet<UniqueAddress> seen = null, Reachability reachability = null)
 {
     return new GossipOverview(seen ?? _seen, reachability ?? _reachability);
 }
コード例 #9
0
ファイル: Gossip.cs プロジェクト: Micha-kun/akka.net
 public GossipOverview(ImmutableHashSet<UniqueAddress> seen, Reachability reachability)
 {
     _seen = seen;
     _reachability = reachability;
 }
コード例 #10
0
ファイル: Gossip.cs プロジェクト: Micha-kun/akka.net
 public GossipOverview(Reachability reachability) : this(ImmutableHashSet.Create<UniqueAddress>(), reachability) { }