@NotThreadSafe public final class UfsJournalReader extends Object implements JournalReader
JournalReader
that reads journal entries from a UFS. It can optionally
read after a given sequence number. By default, it starts from 0 sequence number.
If this reader runs in a primary master, it reads the incomplete log.
If this reader runs in a secondary master, it does not read the incomplete log.Constructor and Description |
---|
UfsJournalReader(UfsJournal journal,
long startSequenceId,
boolean readIncompleteLog)
Creates a new instance of
UfsJournalReader . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
getNextSequenceNumber()
Gets the the sequence number of the next journal log entry to read.
|
Journal.JournalEntry |
read()
Reads an entry from the journal.
|
public UfsJournalReader(UfsJournal journal, long startSequenceId, boolean readIncompleteLog)
UfsJournalReader
.journal
- the handle to the journalstartSequenceId
- the sequence ID to start reading fromreadIncompleteLog
- whether to read incomplete logspublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public long getNextSequenceNumber()
JournalReader
getNextSequenceNumber
in interface JournalReader
public Journal.JournalEntry read() throws IOException, InvalidJournalEntryException
JournalReader
read
in interface JournalReader
InvalidJournalEntryException
- if the journal entry is invalid (e.g. corrupted entry)IOException
Copyright © 2023. All Rights Reserved.