pub fn compact_to(&mut self, index: u64) -> u64 {
        if self.entry_indexes.is_empty() {
            return 0;
        }
        let first = self.first_index;
        if index <= first {
            return 0;
        }
        let count = std::cmp::min((index - first) as usize, self.entry_indexes.len());
        self.first_index = index;
        self.entry_indexes.drain(..count);
        self.maybe_shrink_entry_indexes();

        let compacted_rewrite = std::cmp::min(count, self.rewrite_count);
        self.rewrite_count -= compacted_rewrite;
        self.global_stats
            .delete(LogQueue::Rewrite, compacted_rewrite);
        self.global_stats
            .delete(LogQueue::Append, count - compacted_rewrite);
        count as u64
    }
/// Removes all entries with index smaller than `index`. Returns the number
/// of deleted entries.
Removes all entries with index smaller than `index`. Returns the number
of deleted entries.
Removes all entries with index smaller than ` index ` . Returns the number of deleted entries .
pub fn compact_to(&mut self, index: u64) -> u64 {
        if self.entry_indexes.is_empty() {
            return 0;
        }
        let first = self.first_index;
        if index <= first {
            return 0;
        }
        let count = std::cmp::min((index - first) as usize, self.entry_indexes.len());
        self.first_index = index;
        self.entry_indexes.drain(..count);
        self.maybe_shrink_entry_indexes();
        let compacted_rewrite = std::cmp::min(count, self.rewrite_count);
        self.rewrite_count -= compacted_rewrite;
        self.global_stats
            .delete(LogQueue::Rewrite, compacted_rewrite);
        self.global_stats
            .delete(LogQueue::Append, count - compacted_rewrite);
        count as u64
    }
pub fn compact_to ( & mut self , index : u64 ) -> u64 { if self . entry_indexes . is_empty ( ) { return 0 ; } let first = self . first_index ; if index <= first { return 0 ; } let count = std :: cmp :: min ( ( index - first ) as usize , self . entry_indexes . len ( ) ) ; self . first_index = index ; self . entry_indexes . drain ( .. count ) ; self . maybe_shrink_entry_indexes ( ) ; let compacted_rewrite = std :: cmp :: min ( count , self . rewrite_count ) ; self . rewrite_count -= compacted_rewrite ; self . global_stats . delete ( LogQueue :: Rewrite , compacted_rewrite ) ; self . global_stats . delete ( LogQueue :: Append , count - compacted_rewrite ) ; count as u64 }
Removes all entries with index smaller than `index`.
Removes all entries with index smaller than ` index ` .
&mut self
index
u64