public class BaseStateMachine extends Object implements StateMachine, StateMachine.DataApi, StateMachine.EventApi, StateMachine.LeaderEventApi, StateMachine.FollowerEventApi
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
BaseStateMachine.Task |
StateMachine.DataApi, StateMachine.DataChannel, StateMachine.DataStream, StateMachine.EventApi, StateMachine.FollowerEventApi, StateMachine.LeaderEventApi, StateMachine.RegistryLOGDEFAULTDEFAULTDEFAULTDEFAULT| Constructor and Description |
|---|
BaseStateMachine() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdata, event, followerEvent, leaderEvent, toStateMachineLogEntryStringflush, link, read, stream, truncate, writenotifyConfigurationChanged, notifyGroupRemove, notifyLeaderChanged, notifyLogFailed, notifyServerShutdown, notifySnapshotInstallednotifyFollowerSlowness, notifyFollowerSlowness, notifyNotLeadernotifyExtendedNoLeader, notifyInstallSnapshotFromLeaderpublic RaftPeerId getId()
public LifeCycle getLifeCycle()
public CompletableFuture<RaftServer> getServer()
public RaftGroupId getGroupId()
public LifeCycle.State getLifeCycleState()
getLifeCycleState in interface StateMachinepublic void initialize(RaftServer raftServer, RaftGroupId raftGroupId, RaftStorage storage) throws IOException
initialize in interface StateMachineIOExceptionpublic SnapshotInfo getLatestSnapshot()
getLatestSnapshot in interface StateMachinepublic void pause()
pause in interface StateMachinepublic void reinitialize()
throws IOException
reinitialize in interface StateMachineIOExceptionpublic TransactionContext applyTransactionSerial(TransactionContext trx) throws org.apache.ratis.thirdparty.com.google.protobuf.InvalidProtocolBufferException
applyTransactionSerial in interface StateMachineorg.apache.ratis.thirdparty.com.google.protobuf.InvalidProtocolBufferExceptionpublic CompletableFuture<Message> applyTransaction(TransactionContext trx)
applyTransaction in interface StateMachinepublic TermIndex getLastAppliedTermIndex()
getLastAppliedTermIndex in interface StateMachineprotected void setLastAppliedTermIndex(TermIndex newTI)
public void notifyTermIndexUpdated(long term,
long index)
notifyTermIndexUpdated in interface StateMachine.EventApiprotected boolean updateLastAppliedTermIndex(long term,
long index)
protected boolean updateLastAppliedTermIndex(TermIndex newTI)
public long takeSnapshot()
throws IOException
takeSnapshot in interface StateMachineIOExceptionpublic StateMachineStorage getStateMachineStorage()
getStateMachineStorage in interface StateMachinepublic CompletableFuture<Message> queryStale(Message request, long minIndex)
queryStale in interface StateMachinepublic CompletableFuture<Message> query(Message request)
query in interface StateMachinepublic TransactionContext startTransaction(RaftClientRequest request) throws IOException
startTransaction in interface StateMachineIOExceptionpublic TransactionContext cancelTransaction(TransactionContext trx) throws IOException
cancelTransaction in interface StateMachineIOExceptionpublic TransactionContext preAppendTransaction(TransactionContext trx) throws IOException
preAppendTransaction in interface StateMachineIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionprotected CompletableFuture<Message> recordTime(com.codahale.metrics.Timer timer, BaseStateMachine.Task task)
Copyright © 2017–2023 The Apache Software Foundation. All rights reserved.