Interface RaftManager
- All Superinterfaces:
org.infinispan.commons.api.Lifecycle
- All Known Implementing Classes:
EmptyRaftManager
public interface RaftManager
extends org.infinispan.commons.api.Lifecycle
Use this class to create and register
RaftStateMachine.
Each RaftStateMachine is identified by its name and they are independent of each other; each RaftStateMachine has it own RaftChannel.
- Since:
- 14.0
-
Method Summary
Modifier and TypeMethodDescription<T extends RaftStateMachine>
TgetOrRegisterStateMachine(String channelName, Supplier<T> supplier, RaftChannelConfiguration configuration) Register aRaftStateMachine.booleanCheck if a RAFT leader is elected for theRaftStateMachinewith namechannelName.booleanraftId()Methods inherited from interface org.infinispan.commons.api.Lifecycle
start, stop
-
Method Details
-
getOrRegisterStateMachine
<T extends RaftStateMachine> T getOrRegisterStateMachine(String channelName, Supplier<T> supplier, RaftChannelConfiguration configuration) Register aRaftStateMachine.If the RAFT protocol is not supported, this method return
null. If aRaftStateMachinealready exists with namechannelName, the existing instance is returned.If
isRaftAvailable()returnfalse, this method always returnsnull.- Type Parameters:
T- The concreteRaftStateMachineimplementation.- Parameters:
channelName- The name identifying theRaftStateMachine.supplier- The factory to create a new instance ofRaftStateMachine.configuration- TheRaftChannelConfigurationfor theRaftChannel.- Returns:
- The
RaftStateMachineinstance ofnullif unable to create or configure theRaftChannel.
-
isRaftAvailable
boolean isRaftAvailable()- Returns:
trueif the RAFT protocol is available to be used,falseotherwise.
-
hasLeader
Check if a RAFT leader is elected for theRaftStateMachinewith namechannelName.- Parameters:
channelName- The name identifying theRaftStateMachine.- Returns:
trueif the leader exists,falseotherwise.
-
raftId
String raftId()- Returns:
- This node raft-id.
-