static private DiffSeen ( |
||
oldGossip | ||
newGossip | ||
selfUniqueAddres | UniqueAddress | |
Résultat | ImmutableList |
internal static ImmutableList<SeenChanged> DiffSeen(Gossip oldGossip, Gossip newGossip, UniqueAddress selfUniqueAddres)
{
if (newGossip.Equals(oldGossip))
return ImmutableList.Create<SeenChanged>();
var newConvergence = newGossip.Convergence(selfUniqueAddres);
var newSeenBy = newGossip.SeenBy;
if (newConvergence != oldGossip.Convergence(selfUniqueAddres) || newSeenBy != oldGossip.SeenBy)
return ImmutableList.Create(new SeenChanged(newConvergence,
newSeenBy.Select(s => s.Address).ToImmutableHashSet()));
return ImmutableList.Create<SeenChanged>();
}
private void PublishDiff(Gossip oldGossip, Gossip newGossip, Action <object> pub) { foreach (var @event in ClusterEvent.DiffMemberEvents(oldGossip, newGossip)) { pub(@event); } foreach (var @event in ClusterEvent.DiffUnreachable(oldGossip, newGossip)) { pub(@event); } foreach (var @event in ClusterEvent.DiffReachable(oldGossip, newGossip)) { pub(@event); } foreach (var @event in ClusterEvent.DiffLeader(oldGossip, newGossip, _selfUniqueAddress)) { pub(@event); } foreach (var @event in ClusterEvent.DiffRolesLeader(oldGossip, newGossip, _selfUniqueAddress)) { pub(@event); } // publish internal SeenState for testing purposes foreach (var @event in ClusterEvent.DiffSeen(oldGossip, newGossip, _selfUniqueAddress)) { pub(@event); } foreach (var @event in ClusterEvent.DiffReachability(oldGossip, newGossip)) { pub(@event); } }