Class MutableDigest

  • All Implemented Interfaces:
    java.lang.Iterable<Digest.Entry>, Constructable<Digest>, SizeStreamable, Streamable

    public class MutableDigest
    extends Digest
    A mutable version of Digest. Has a fixed size (that of the members), but individual seqnos can be changed. This class is not synchronized
    Author:
    Bela Ban
    • Constructor Detail

      • MutableDigest

        public MutableDigest()
      • MutableDigest

        public MutableDigest​(Address[] members)
      • MutableDigest

        public MutableDigest​(Digest digest)
        Only used for testing
    • Method Detail

      • set

        public MutableDigest set​(Address member,
                                 long highest_delivered_seqno,
                                 long highest_received_seqno)
      • allSet

        public boolean allSet()
        Returns true if all members have a corresponding seqno >= 0, else false
      • getNonSetMembers

        public Address[] getNonSetMembers()
        Returns an array of members whose seqno is not set. Returns an empty array if all are set.
      • merge

        public MutableDigest merge​(Digest digest)
        Adds a digest to this digest. For each sender in the other digest, the merge() method will be called.
      • merge

        public MutableDigest merge​(Address member,
                                   long highest_delivered_seqno,
                                   long highest_received_seqno)
        Similar to set(), but if the sender already exists, its seqnos will be modified (no new entry) as follows:
        1. this.highest_delivered_seqno=max(this.highest_delivered_seqno, highest_delivered_seqno)
        2. this.highest_received_seqno=max(this.highest_received_seqno, highest_received_seqno)
      • createEmptyArray

        protected static long[] createEmptyArray​(int size)
      • countNonSetMembers

        protected int countNonSetMembers()