Make JournalSegmentWriter.getLastIndex() final
[controller.git] / atomix-storage / src / main / java / io / atomix / storage / journal / MappedJournalSegmentWriter.java
index 22c03be39f6ffb1f91ecab4dbd453437750fd9fb..ffc45dcfe75c3d5d4969b81b910b53f0de00014d 100644 (file)
@@ -149,11 +149,6 @@ final class MappedJournalSegmentWriter<E> extends JournalSegmentWriter<E> {
     }
   }
 
-  @Override
-  long getLastIndex() {
-    return lastEntry != null ? lastEntry.index() : firstIndex - 1;
-  }
-
   @Override
   Indexed<E> getLastEntry() {
     return lastEntry;
@@ -168,22 +163,6 @@ final class MappedJournalSegmentWriter<E> extends JournalSegmentWriter<E> {
     }
   }
 
-  @Override
-  void append(Indexed<E> entry) {
-    final long nextIndex = getNextIndex();
-
-    // If the entry's index is greater than the next index in the segment, skip some entries.
-    if (entry.index() > nextIndex) {
-      throw new IndexOutOfBoundsException("Entry index is not sequential");
-    }
-
-    // If the entry's index is less than the next index, truncate the segment.
-    if (entry.index() < nextIndex) {
-      truncate(entry.index() - 1);
-    }
-    append(entry.entry());
-  }
-
   @Override
   @SuppressWarnings("unchecked")
   <T extends E> Indexed<T> append(T entry) {