pub fn maybe_decr_to(&mut self, rejected: u64, last: u64) -> bool {
        if self.state == Replicate {
            // The rejected must be stale if the progress has matched and "rejected"
            // is smaller than "match".
            if rejected <= self._match {
                return false;
            }
            // Directly decrease next to match + 1
            //
            // TODO(tbg): Why not use last if it's larger?
            self.next = self._match + 1;
            return true;
        }

        // TODO: add by me
        assert!(self.next > 0);
        // The rejection must be stale if "rejected" does not match next - 1. This
        // is because non-replicating followers are probed one entry at a time.
        if self.next - 1 != rejected {
            return false;
        }

        self.next = rejected.min(last + 1);
        if self.next < 1 {
            self.next = 1;
        }
        self.probe_sent = false;
        true
    }
/// MaybeDecrTo adjust the Progress to the receipt of a MsgApp rejection. The
/// arguments are the index the follower rejected to append to its log, and its
/// last index.
///
/// rejecteds can happen spuriously as messages are sent out of order or
/// duplicated. In such cases, the rejection pertains to an index that the
/// Progress already knows were previously acknowledged, and false is returned
/// without changing the Progress.
///
/// If the rejection is genuine, Next is lowered sensibly, and the Progress is
/// cleared for sending log entries
MaybeDecrTo adjust the Progress to the receipt of a MsgApp rejection. The
arguments are the index the follower rejected to append to its log, and its
last index.

rejecteds can happen spuriously as messages are sent out of order or
duplicated. In such cases, the rejection pertains to an index that the
Progress already knows were previously acknowledged, and false is returned
without changing the Progress.

If the rejection is genuine, Next is lowered sensibly, and the Progress is
cleared for sending log entries
MaybeDecrTo adjust the Progress to the receipt of a MsgApp rejection . The arguments are the index the follower rejected to append to its log and its last index . rejecteds can happen spuriously as messages are sent out of order or duplicated . In such cases the rejection pertains to an index that the Progress already knows were previously acknowledged and false is returned without changing the Progress . If the rejection is genuine Next is lowered sensibly and the Progress is cleared for sending log entries
pub fn maybe_decr_to(&mut self, rejected: u64, last: u64) -> bool {
        if self.state == Replicate {
            // The rejected must be stale if the progress has matched and "rejected"
            // is smaller than "match".
            if rejected <= self._match {
                return false;
            }
            // Directly decrease next to match + 1
            //
            // TODO(tbg): Why not use last if it's larger?
            self.next = self._match + 1;
            return true;
        }
        // TODO: add by me
        assert!(self.next > 0);
        // The rejection must be stale if "rejected" does not match next - 1. This
        // is because non-replicating followers are probed one entry at a time.
        if self.next - 1 != rejected {
            return false;
        }
        self.next = rejected.min(last + 1);
        if self.next < 1 {
            self.next = 1;
        }
        self.probe_sent = false;
        true
    }
pub fn maybe_decr_to ( & mut self , rejected : u64 , last : u64 ) -> bool { if self . state == Replicate { // The rejected must be stale if the progress has matched and "rejected" // is smaller than "match". if rejected <= self . _match { return false ; } // Directly decrease next to match + 1 // // TODO(tbg): Why not use last if it's larger? self . next = self . _match + 1 ; return true ; } // TODO: add by me assert ! ( self next 0 ) ; // The rejection must be stale if "rejected" does not match next - 1. This // is because non-replicating followers are probed one entry at a time. if self . next - 1 != rejected { return false ; } self . next = rejected . min ( last + 1 ) ; if self . next < 1 { self . next = 1 ; } self . probe_sent = false ; true }
MaybeDecrTo adjust the Progress to the receipt of a MsgApp rejection.
MaybeDecrTo adjust the Progress to the receipt of a MsgApp rejection .
&mut self
rejected
u64
last
u64