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) |
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.
|
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.
|
Map<String,Long> |
getCurrentSequenceNumbers()
Used to get the current state from a leader journal system.
|
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 |
resume()
Resumes applying for all journals.
|
void |
start()
Starts the journal system.
|
void |
stop()
Stops the journal system.
|
void |
suspend()
Suspends applying for all journals.
|
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 void suspend()
JournalSystem
suspend
in interface JournalSystem
public void resume()
JournalSystem
resume
in interface JournalSystem
public CatchupFuture catchup(Map<String,Long> journalSequenceNumbers)
JournalSystem
catchup
in interface JournalSystem
journalSequenceNumbers
- sequence to advance per each journalpublic Map<String,Long> getCurrentSequenceNumbers()
JournalSystem
getCurrentSequenceNumbers
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.