src/Orleans.Runtime/MembershipService/ClusterMembershipSnapshot.cs
/// <summary>
/// Returns a <see cref="ClusterMembershipUpdate"/> which represents the change in cluster membership from the provided snapshot to this instance.
/// </summary>
/// <returns>A <see cref="ClusterMembershipUpdate"/> which represents the change in cluster membership from the provided snapshot to this instance.</returns>
Returns a  which represents the change in cluster membership from the provided snapshot to this instance.
Returns a which represents the change in cluster membership from the provided snapshot to this instance .
public ClusterMembershipUpdate CreateUpdate(ClusterMembershipSnapshot previous)
        {
            if (previous is null) throw new ArgumentNullException(nameof(previous));
            if (this.Version < previous.Version)
            {
                throw new ArgumentException($"Argument must have a previous version to the current instance. Expected <= {this.Version}, encountered {previous.Version}", nameof(previous));
            }
            if (this.Version == previous.Version)
            {
                return new ClusterMembershipUpdate(this, ImmutableArray<ClusterMember>.Empty);
            }
            var changes = ImmutableHashSet.CreateBuilder<ClusterMember>();
            foreach (var entry in this.Members)
            {
                if (!previous.Members.TryGetValue(entry.Key, out var previousEntry) || previousEntry.Status != entry.Value.Status)
                {
                    changes.Add(entry.Value);
                }
            }
            foreach (var entry in previous.Members)
            {
                if (!this.Members.TryGetValue(entry.Key, out _))
                {
                    changes.Add(new ClusterMember(entry.Key, SiloStatus.Dead, entry.Value.Name));
                }
            }
            return new ClusterMembershipUpdate(this, changes.ToImmutableArray());
        }
public ClusterMembershipUpdate CreateUpdate ( ClusterMembershipSnapshot previous ) { if ( previous is null ) throw new ArgumentNullException ( nameof ( previous ) ) ; if ( this . Version < previous . Version ) { throw new ArgumentException ( $" Argument must have a previous version to the current instance. Expected <=  { this . Version } , encountered  { previous . Version } " , nameof ( previous ) ) ; } if ( this . Version == previous . Version ) { return new ClusterMembershipUpdate ( this , ImmutableArray < ClusterMember > . Empty ) ; } var changes = ImmutableHashSet . CreateBuilder < ClusterMember > ( ) ; foreach ( var entry in this . Members ) { if ( ! previous . Members . TryGetValue ( entry . Key , out var previousEntry ) || previousEntry . Status != entry . Value . Status ) { changes . Add ( entry . Value ) ; } } foreach ( var entry in previous . Members ) { if ( ! this . Members . TryGetValue ( entry . Key , out _ ) ) { changes . Add ( new ClusterMember ( entry . Key , SiloStatus . Dead , entry . Value . Name ) ) ; } } return new ClusterMembershipUpdate ( this , changes . ToImmutableArray ( ) ) ; }
Returns a  which represents the change in cluster membership from the provided snapshot to this instance.
Returns a which represents the change in cluster membership from the provided snapshot to this instance .
// Include any entry which is new or has changed state. // Handle entries which were removed entirely.
A  which represents the change in cluster membership from the provided snapshot to this instance.
A which represents the change in cluster membership from the provided snapshot to this instance .
previous
ClusterMembershipSnapshot