public final class NoopJournalSystem extends Object implements JournalSystem
JournalSystem.Builder, JournalSystem.Mode
Constructor and Description |
---|
NoopJournalSystem()
Constructs a new
NoopJournalSystem . |
Modifier and Type | Method and Description |
---|---|
void |
addJournalSink(Master master,
JournalSink journalSink) |
void |
checkpoint()
Creates a checkpoint in the primary master journal system.
|
Journal |
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.
|
Set<JournalSink> |
getJournalSinks(Master master) |
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 |
removeJournalSink(Master master,
JournalSink journalSink) |
void |
start()
Starts the journal system.
|
void |
stop()
Stops the journal system.
|
public NoopJournalSystem()
NoopJournalSystem
.public Journal 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.createJournal
in interface JournalSystem
master
- the master to create the journal forJournal
public void gainPrimacy()
JournalSystem
gainPrimacy
in interface JournalSystem
public void losePrimacy()
JournalSystem
losePrimacy
in interface JournalSystem
public boolean isFormatted()
isFormatted
in interface JournalSystem
public void addJournalSink(Master master, JournalSink journalSink)
addJournalSink
in interface JournalSystem
master
- the master for which to add the journal sinkjournalSink
- the journal sink to addpublic void removeJournalSink(Master master, JournalSink journalSink)
removeJournalSink
in interface JournalSystem
master
- the master from which to remove the journal sinkjournalSink
- the journal sink to removepublic Set<JournalSink> getJournalSinks(@Nullable Master master)
getJournalSinks
in interface JournalSystem
master
- the master to get the journal sinks for, or null to get all sinksJournalSink
for the given master, or all sinks if master is nullpublic boolean isEmpty()
JournalSystem
isEmpty
in interface JournalSystem
public void format()
JournalSystem
format
in interface JournalSystem
public void start()
JournalSystem
start
in interface JournalSystem
public void stop()
JournalSystem
stop
in interface JournalSystem
public void checkpoint()
JournalSystem
checkpoint
in interface JournalSystem
Copyright © 2023. All Rights Reserved.