@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()
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 secondary 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.
|
addJournalSink, getJournalSinks, 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 SECONDARY 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 Map<String,Long> getCurrentSequenceNumbers()
JournalSystem
public void startInternal() throws IOException
AbstractJournalSystem
startInternal
in class AbstractJournalSystem
IOException
public void stopInternal()
AbstractJournalSystem
stopInternal
in class AbstractJournalSystem
public boolean isFormatted() throws IOException
IOException
public boolean isEmpty()
JournalSystem
public void format() throws IOException
JournalSystem
IOException
public void checkpoint() throws IOException
JournalSystem
IOException
Copyright © 2023. All Rights Reserved.