public void truncateAfter ( long newTruncationPoint ) { if ( size ( ) == 0 ) { m_map . add ( range ( newTruncationPoint , newTruncationPoint ) ) ; m_hasSentinel = true ; return ; } if ( newTruncationPoint > getLastSeqNo ( ) ) { return ; } final Iterator < Range < Long > > iter = m_map . asDescendingSetOfRanges ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { final Range < Long > next = iter . next ( ) ; if ( start ( next ) > newTruncationPoint ) { iter . remove ( ) ; } else if ( next . contains ( newTruncationPoint ) ) { iter . remove ( ) ; m_map . add ( range ( start ( next ) , newTruncationPoint ) ) ; return ; } else { break ; } } if ( m_map . isEmpty ( ) ) { m_map . add ( range ( newTruncationPoint , newTruncationPoint ) ) ; m_hasSentinel = true ; } }
Truncate the tracker to the given truncation point . After truncation any ranges after the new truncation point will be removed . If the new safe point is after the last sequence number of the tracker it s a no - op . If the map is empty truncation point will be the new safe point of tracker .