@ThreadSafe public final class UfsJournalWriter extends Object implements JournalWriter
JournalWriter
based on UFS.Modifier and Type | Class and Description |
---|---|
protected static class |
UfsJournalWriter.EntryOutputStream
This is the output stream for the journal entries after the checkpoint.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the journal.
|
void |
completeCurrentLog()
Marks the current log as completed.
|
void |
completeLogs()
Marks all logs as completed.
|
void |
deleteCompletedLogs()
Deletes all of the completed logs.
|
void |
flush()
Flushes the current log stream.
|
JournalOutputStream |
getCheckpointOutputStream(long latestSequenceNumber)
Returns an output stream for the journal checkpoint.
|
long |
getNextSequenceNumber() |
void |
recover()
Recovers the checkpoint in case the master crashed while updating it previously.
|
void |
write(Journal.JournalEntry entry)
Writes an entry to the current log stream.
|
public void completeLogs() throws IOException
JournalWriter
completeLogs
in interface JournalWriter
IOException
public JournalOutputStream getCheckpointOutputStream(long latestSequenceNumber) throws IOException
JournalWriter
getCheckpointOutputStream
in interface JournalWriter
latestSequenceNumber
- the sequence number of the latest journal entry. This sequence
number will be used to determine the next sequence numbers for the subsequent journal
entries.IOException
public void write(Journal.JournalEntry entry) throws IOException
JournalWriter
JournalWriter.flush()
should be called
afterward to ensure the entry is persisted.write
in interface JournalWriter
entry
- the journal entry to writeIOException
public void flush() throws IOException
JournalWriter
flush
in interface JournalWriter
IOException
public long getNextSequenceNumber()
getNextSequenceNumber
in interface JournalWriter
public void close() throws IOException
JournalWriter
close
in interface JournalWriter
IOException
public void recover()
JournalWriter
recover
in interface JournalWriter
public void deleteCompletedLogs() throws IOException
JournalWriter
deleteCompletedLogs
in interface JournalWriter
IOException
public void completeCurrentLog() throws IOException
JournalWriter
completeCurrentLog
in interface JournalWriter
IOException
Copyright © 2023. All Rights Reserved.