Remove unused {FileChannel,Mapped}JournalSegmentWriter methods 64/110564/3
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 9 Mar 2024 12:38:05 +0000 (13:38 +0100)
committerRobert Varga <nite@hq.sk>
Mon, 11 Mar 2024 12:51:11 +0000 (12:51 +0000)
We have a few methods which are not used anywhere, remove them to
simplify things.

JIRA: CONTROLLER-2095
Change-Id: I508d92cc2c761a6432e24e70db400636764753c8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
atomix-storage/src/main/java/io/atomix/storage/journal/FileChannelJournalSegmentWriter.java
atomix-storage/src/main/java/io/atomix/storage/journal/MappedJournalSegmentWriter.java

index ba99cf3c7e322ef5ce627cd2af29ccf1342c54cf..5c7af3fdb4f361ae1355e45fd43b9943db51ae85 100644 (file)
@@ -163,45 +163,6 @@ class FileChannelJournalSegmentWriter<E> implements JournalWriter<E> {
     }
   }
 
-  /**
-   * Returns the size of the underlying buffer.
-   *
-   * @return The size of the underlying buffer.
-   */
-  public long size() {
-    try {
-      return channel.position();
-    } catch (IOException e) {
-      throw new StorageException(e);
-    }
-  }
-
-  /**
-   * Returns a boolean indicating whether the segment is empty.
-   *
-   * @return Indicates whether the segment is empty.
-   */
-  public boolean isEmpty() {
-    return lastEntry == null;
-  }
-
-  /**
-   * Returns a boolean indicating whether the segment is full.
-   *
-   * @return Indicates whether the segment is full.
-   */
-  public boolean isFull() {
-    return size() >= segment.descriptor().maxSegmentSize()
-        || getNextIndex() - firstIndex >= segment.descriptor().maxEntries();
-  }
-
-  /**
-   * Returns the first index written to the segment.
-   */
-  public long firstIndex() {
-    return firstIndex;
-  }
-
   @Override
   public void append(Indexed<E> entry) {
     final long nextIndex = getNextIndex();
index d461b81aec7001e900c77b61836209b809745667..6ca6ab30dd72cce4a8952782375d83a2e17b3c67 100644 (file)
@@ -148,24 +148,6 @@ class MappedJournalSegmentWriter<E> implements JournalWriter<E> {
     }
   }
 
-  /**
-   * Returns the size of the underlying buffer.
-   *
-   * @return The size of the underlying buffer.
-   */
-  public long size() {
-    return buffer.position() + JournalSegmentDescriptor.BYTES;
-  }
-
-  /**
-   * Returns a boolean indicating whether the segment is empty.
-   *
-   * @return Indicates whether the segment is empty.
-   */
-  public boolean isEmpty() {
-    return lastEntry == null;
-  }
-
   @Override
   public void append(Indexed<E> entry) {
     final long nextIndex = getNextIndex();