@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.
|
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 |
snapshot(io.atomix.copycat.server.storage.snapshot.SnapshotWriter writer) |
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 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.