JournalReader is not an Iterator 94/110694/2
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 13 Mar 2024 12:32:07 +0000 (13:32 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 13 Mar 2024 13:06:56 +0000 (14:06 +0100)
commitcfe137aaad17ccc691f25ce517bf83a765216b63
treec9a73c75a4db93f4e9ade1c7024a91c9270c9f6e
parent86ff19a91c2d4aa71f88135898ebc75fd3caee85
JournalReader is not an Iterator

Iterator dictating a two method API, which is not quite appropriate, as
the writer could be manipulated between hasNext() and next() methods --
and next() has to perform validation again.

Introduce JournalReader.tryNext(), which returns a @Nullable Indexed --
either the next entry (as next()), or null (indicating !hasNext() case).

JIRA: CONTROLLER-2106
Change-Id: Ie0338a9869ece8e6381ae719a29e97fd569b442f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
atomix-storage/src/main/java/io/atomix/storage/journal/CommitsSegmentJournalReader.java
atomix-storage/src/main/java/io/atomix/storage/journal/JournalReader.java
atomix-storage/src/main/java/io/atomix/storage/journal/SegmentedJournal.java
atomix-storage/src/main/java/io/atomix/storage/journal/SegmentedJournalReader.java
atomix-storage/src/test/java/io/atomix/storage/journal/AbstractJournalTest.java
opendaylight/md-sal/sal-akka-segmented-journal/src/main/java/org/opendaylight/controller/akka/segjournal/DataJournalV0.java