@ThreadSafe public class JournalStateMachine extends io.atomix.copycat.server.StateMachine implements io.atomix.copycat.server.Snapshottable
upgrade()
. Once the state machine is upgraded,
it will ignore all entries appended by copycat because those entries are applied to primary
master state before being written to copycat.Constructor and Description |
---|
JournalStateMachine(Map<String,RaftJournal> journals,
java.util.function.Supplier<Set<JournalSink>> journalSinks) |
Modifier and Type | Method and Description |
---|---|
void |
applyJournalEntryCommand(io.atomix.copycat.server.Commit<JournalEntryCommand> commit)
Applies a journal entry commit to the state machine.
|
CatchupFuture |
catchup(long sequence)
Initiates catching up of masters to given sequence.
|
void |
close()
Closes the journal state machine, causing all further modification requests to be ignored.
|
long |
getLastAppliedSequenceNumber() |
long |
getLastPrimaryStartSequenceNumber() |
long |
getLastSnapshotStartTime() |
void |
install(io.atomix.copycat.server.storage.snapshot.SnapshotReader snapshotReader) |
boolean |
isSnapshotting() |
void |
resume()
Resumes applying to masters.
|
void |
snapshot(io.atomix.copycat.server.storage.snapshot.SnapshotWriter writer) |
void |
suspend()
Suspends applying to masters.
|
long |
upgrade()
Upgrades the journal state machine to primary mode.
|
public JournalStateMachine(Map<String,RaftJournal> journals, java.util.function.Supplier<Set<JournalSink>> journalSinks)
journals
- master journals; these journals are still owned by the caller, not by the
journal state machinejournalSinks
- a supplier for journal sinkspublic void applyJournalEntryCommand(io.atomix.copycat.server.Commit<JournalEntryCommand> commit)
commit
- the commitpublic void snapshot(io.atomix.copycat.server.storage.snapshot.SnapshotWriter writer)
snapshot
in interface io.atomix.copycat.server.Snapshottable
public void install(io.atomix.copycat.server.storage.snapshot.SnapshotReader snapshotReader)
install
in interface io.atomix.copycat.server.Snapshottable
public void suspend() throws IOException
IOException
public void resume() throws IOException
IOException
public CatchupFuture catchup(long sequence)
sequence
- the target sequencepublic long upgrade()
public long getLastAppliedSequenceNumber()
public long getLastPrimaryStartSequenceNumber()
public long getLastSnapshotStartTime()
public boolean isSnapshotting()
public void close()
close
in interface AutoCloseable
close
in class io.atomix.copycat.server.StateMachine
Copyright © 2023. All Rights Reserved.