public interface RaftStateMachine
extends java.lang.AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
<T> java.util.concurrent.CompletableFuture<T> |
apply(io.atomix.storage.journal.Indexed<? extends io.atomix.protocols.raft.storage.log.entry.RaftLogEntry> entry)
Applies an entry to the state machine.
|
<T> java.util.concurrent.CompletableFuture<T> |
apply(long index)
Applies the entry at the given index to the state machine.
|
void |
applyAll(long index)
Applies all commits up to the given index.
|
void |
close()
Close any opened resources; note however that the thread context should NOT be closed, as it is
managed by the Raft server.
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
compact()
Compacts Raft logs.
|
io.atomix.utils.concurrent.ThreadContext |
executor()
The state machine thread context; can be used to sequence operations on the state machine.
|
long |
getCompactableIndex()
Returns the current compactable index.
|
long |
getCompactableTerm()
Returns the term of the entry with the current compactable index.
|
default void |
setCompactablePosition(long index,
long term)
Updates the compactable position; by default does nothing as the default behaviour is to use
the last applied index and term.
|
io.atomix.utils.concurrent.ThreadContext executor()
java.util.concurrent.CompletableFuture<java.lang.Void> compact()
void applyAll(long index)
Calls to this method are assumed not to expect a result. This allows some optimizations to be made internally since linearizable events don't have to be waited to complete the command.
index - The index up to which to apply commits.<T> java.util.concurrent.CompletableFuture<T> apply(long index)
Calls to this method are assumed to expect a result. This means linearizable session events triggered by the application of the command at the given index will be awaited before completing the returned future.
index - The index to apply.<T> java.util.concurrent.CompletableFuture<T> apply(io.atomix.storage.journal.Indexed<? extends io.atomix.protocols.raft.storage.log.entry.RaftLogEntry> entry)
Calls to this method are assumed to expect a result. This means linearizable session events triggered by the application of the given entry will be awaited before completing the returned future.
entry - The entry to apply.void close()
close in interface java.lang.AutoCloseabledefault void setCompactablePosition(long index,
long term)
index - index up to which the log can be compactedterm - term of the entry with that index, used when snapshottinglong getCompactableIndex()
long getCompactableTerm()
Copyright © 2013-2019. All Rights Reserved.