@NotThreadSafe public class UfsJournalSystem extends AbstractJournalSystem
JournalSystem.Builder, JournalSystem.Mode
Constructor and Description |
---|
UfsJournalSystem(URI base,
long quietTimeMs)
Creates a UFS journal system with the specified base location.
|
Modifier and Type | Method and Description |
---|---|
CatchupFuture |
catchup(Map<String,Long> journalSequenceNumbers)
Initiates a catching up of journals to given sequences.
|
void |
checkpoint(StateLockManager stateLockManager)
Creates a checkpoint in the primary master journal system.
|
UfsJournal |
createJournal(Master master)
Creates a journal for the given state machine.
|
void |
format()
Formats the journal system.
|
void |
gainPrimacy()
Transitions the journal to primary mode.
|
Map<String,Long> |
getCurrentSequenceNumbers()
Used to get the current state from a leader journal system.
|
boolean |
isEmpty()
Returns whether the journal is formatted and has not had any entries written to it yet.
|
boolean |
isFormatted() |
void |
losePrimacy()
Transitions the journal to standby mode.
|
void |
resume()
Resumes applying for all journals.
|
void |
startInternal()
Starts the journal system.
|
void |
stopInternal()
Stops the journal system.
|
void |
suspend(Runnable interruptCallback)
Suspends applying for all journals.
|
void |
waitForCatchup()
Waits for the journal catchup to finish when the process starts.
|
addJournalSink, getJournalSinks, registerMetrics, removeJournalSink, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getJournalServices
public UfsJournalSystem(URI base, long quietTimeMs)
base
- the base location for journals created by this factoryquietTimeMs
- before upgrading from STANDBY to PRIMARY mode, the journal will wait until
this duration has passed without any journal entries being written.public UfsJournal createJournal(Master master)
JournalSystem
Journaled#processJournalEntry(JournalEntry)
and
Journaled.resetState()
to keep the state machine's state in sync with
the entries written to the journal.master
- the master to create the journal forJournal
public void gainPrimacy()
JournalSystem
public void losePrimacy()
JournalSystem
public void suspend(Runnable interruptCallback) throws IOException
JournalSystem
interruptCallback
- the callback function to be invoked when the suspension is interruptedIOException
public void resume() throws IOException
JournalSystem
IOException
public CatchupFuture catchup(Map<String,Long> journalSequenceNumbers) throws IOException
JournalSystem
journalSequenceNumbers
- sequence to advance per each journalIOException
public void waitForCatchup()
JournalSystem
public Map<String,Long> getCurrentSequenceNumbers()
JournalSystem
public void startInternal()
AbstractJournalSystem
startInternal
in class AbstractJournalSystem
public void stopInternal()
AbstractJournalSystem
stopInternal
in class AbstractJournalSystem
public boolean isFormatted()
public boolean isEmpty()
JournalSystem
public void format() throws IOException
JournalSystem
IOException
public void checkpoint(StateLockManager stateLockManager) throws IOException
JournalSystem
stateLockManager
- used to prevent reads and writes while the journal system is
checkpointingIOException
Copyright © 2023. All Rights Reserved.