Leader() public method

public Leader ( UniqueAddress selfUniqueAddress ) : UniqueAddress
selfUniqueAddress UniqueAddress
return UniqueAddress
コード例 #1
0
ファイル: ClusterEvent.cs プロジェクト: tjaskula/akka.net
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="oldGossip">TBD</param>
        /// <param name="newGossip">TBD</param>
        /// <param name="selfUniqueAddress">TBD</param>
        /// <returns>TBD</returns>
        internal static ImmutableList<LeaderChanged> DiffLeader(Gossip oldGossip, Gossip newGossip, UniqueAddress selfUniqueAddress)
        {
            var newLeader = newGossip.Leader(selfUniqueAddress);
            if ((newLeader == null && oldGossip.Leader(selfUniqueAddress) == null)
                || newLeader != null && newLeader.Equals(oldGossip.Leader(selfUniqueAddress)))
                return ImmutableList<LeaderChanged>.Empty;

            return ImmutableList.Create(newLeader == null
                ? new LeaderChanged(null)
                : new LeaderChanged(newLeader.Address));
        }
コード例 #2
0
ファイル: ClusterEvent.cs プロジェクト: tjaskula/akka.net
        /// <summary>
        /// The current snapshot state corresponding to latest gossip 
        /// to mimic what you would have seen if you were listening to the events.
        /// </summary>
        private void SendCurrentClusterState(IActorRef receiver)
        {
            var unreachable = _latestGossip.Overview.Reachability.AllUnreachableOrTerminated
                .Where(node => !node.Equals(_selfUniqueAddress))
                .Select(node => _latestGossip.GetMember(node))
                .ToImmutableHashSet();

            var state = new ClusterEvent.CurrentClusterState(
                members: _latestGossip.Members,
                unreachable: unreachable,
                seenBy: _latestGossip.SeenBy.Select(s => s.Address).ToImmutableHashSet(),
                leader: _latestGossip.Leader(_selfUniqueAddress) == null ? null : _latestGossip.Leader(_selfUniqueAddress).Address,
                roleLeaderMap: _latestGossip.AllRoles.ToImmutableDictionary(r => r, r =>
                {
                    var leader = _latestGossip.RoleLeader(r, _selfUniqueAddress);
                    return leader == null ? null : leader.Address;
                }));
            receiver.Tell(state);
        }
コード例 #3
0
        internal static ImmutableList<LeaderChanged> DiffLeader(Gossip oldGossip, Gossip newGossip, UniqueAddress selfUniqueAddress)
        {
            var newLeader = newGossip.Leader(selfUniqueAddress);
            if ((newLeader == null && oldGossip.Leader(selfUniqueAddress) == null) 
                || newLeader != null && newLeader.Equals(oldGossip.Leader(selfUniqueAddress))) 
                return ImmutableList.Create<LeaderChanged>();

            return ImmutableList.Create(newLeader == null 
                ? new LeaderChanged(null) 
                : new LeaderChanged(newLeader.Address));
        }