Example #1
0
        /// <summary>
        /// Merges two receive buffers. Merging preserves sequencing of messages, and drops all messages that has been
        /// safely acknowledged by any of the participating buffers. Also updates the expected sequence numbers.
        /// </summary>
        /// <param name="other">The receive buffer to merge with</param>
        /// <returns>The merged receive buffer</returns>
        public AckedReceiveBuffer <T> MergeFrom(AckedReceiveBuffer <T> other)
        {
            var mergedLastDelivered = SeqNo.Max(this.LastDelivered, other.LastDelivered);

            Buf.UnionWith(other.Buf);
            Buf.RemoveWhere(x => x.Seq < mergedLastDelivered);
            return(Copy(mergedLastDelivered, SeqNo.Max(this.CumulativeAck, other.CumulativeAck), Buf));
        }
Example #2
0
 public bool Equals(AckedReceiveBuffer <T> other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(LastDelivered.Equals(other.LastDelivered) &&
            CumulativeAck.Equals(other.CumulativeAck));
 }
Example #3
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="buffer">TBD</param>
 /// <param name="deliverables">TBD</param>
 /// <param name="ack">TBD</param>
 public AckReceiveDeliverable(AckedReceiveBuffer <T> buffer, List <T> deliverables, Ack ack)
 {
     Ack          = ack;
     Deliverables = deliverables;
     Buffer       = buffer;
 }
Example #4
0
 public ResendState(int uid, AckedReceiveBuffer <Message> buffer)
 {
     Buffer = buffer;
     Uid    = uid;
 }
Example #5
0
        /// <summary>
        /// Merges two receive buffers. Merging preserves sequencing of messages, and drops all messages that has been
        /// safely acknowledged by any of the participating buffers. Also updates the expected sequence numbers.
        /// </summary>
        /// <param name="other">The receive buffer to merge with</param>
        /// <returns>The merged receive buffer</returns>
        public AckedReceiveBuffer <T> MergeFrom(AckedReceiveBuffer <T> other)
        {
            var mergedLastDelivered = SeqNo.Max(this.LastDelivered, other.LastDelivered);

            return(Copy(mergedLastDelivered, SeqNo.Max(this.CumulativeAck, other.CumulativeAck), Buf.Union(other.Buf).Where(x => x.Seq > mergedLastDelivered).ToImmutableSortedSet(Comparer)));
        }