X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=atomix-storage%2Fsrc%2Fmain%2Fjava%2Fio%2Fatomix%2Fstorage%2Fjournal%2FJournalWriter.java;h=1462463e9d68c8049f68f85ea34fdfbb4734144a;hb=HEAD;hp=95284978bd9af283b696366b85d80acb7cde5ffc;hpb=42aa6677b87768cfc3a0f63539c5a6e6a2f509cb;p=controller.git
diff --git a/atomix-storage/src/main/java/io/atomix/storage/journal/JournalWriter.java b/atomix-storage/src/main/java/io/atomix/storage/journal/JournalWriter.java
index 95284978bd..649e43e4ef 100644
--- a/atomix-storage/src/main/java/io/atomix/storage/journal/JournalWriter.java
+++ b/atomix-storage/src/main/java/io/atomix/storage/journal/JournalWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-present Open Networking Foundation
+ * Copyright 2017-2022 Open Networking Foundation and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,64 +15,46 @@
*/
package io.atomix.storage.journal;
+import org.eclipse.jdt.annotation.NonNull;
+
/**
* Log writer.
*
* @author Jordan Halterman
*/
public interface JournalWriter {
- /**
- * Returns the last written index.
- *
- * @return The last written index.
- */
- long getLastIndex();
-
- /**
- * Returns the last entry written.
- *
- * @return The last entry written.
- */
- Indexed getLastEntry();
-
- /**
- * Returns the next index to be written.
- *
- * @return The next index to be written.
- */
- long getNextIndex();
-
- /**
- * Appends an entry to the journal.
- *
- * @param entry The entry to append.
- * @return The appended indexed entry.
- */
- Indexed append(T entry);
-
- /**
- * Commits entries up to the given index.
- *
- * @param index The index up to which to commit entries.
- */
- void commit(long index);
-
- /**
- * Resets the head of the journal to the given index.
- *
- * @param index the index to which to reset the head of the journal
- */
- void reset(long index);
-
- /**
- * Truncates the log to the given index.
- *
- * @param index The index to which to truncate the log.
- */
- void truncate(long index);
-
- /**
- * Flushes written entries to disk.
- */
- void flush();
+ /**
+ * Returns the next index to be written.
+ *
+ * @return The next index to be written.
+ */
+ long getNextIndex();
+
+ /**
+ * Appends an entry to the journal.
+ *
+ * @param entry The entry to append.
+ * @return The appended indexed entry.
+ */
+ @NonNull Indexed append(T entry);
+
+ /**
+ * Commits entries up to the given index.
+ *
+ * @param index The index up to which to commit entries.
+ */
+ void commit(long index);
+
+ /**
+ * Resets the head of the journal to the given index.
+ *
+ * @param index the next index to write
+ * @throws IndexOutOfBoundsException if the journal cannot be reset to specified index
+ */
+ void reset(long index);
+
+ /**
+ * Flushes written entries to disk.
+ */
+ void flush();
}