public class RaftMachine extends Object implements LeaderLocator, CoreMetaData
The algorithm is driven by incoming messages provided to handle(org.neo4j.causalclustering.core.consensus.RaftMessages.RaftMessage).
| Modifier and Type | Class and Description |
|---|---|
static class |
RaftMachine.BootstrapException |
static class |
RaftMachine.Timeouts |
| Constructor and Description |
|---|
RaftMachine(MemberId myself,
StateStorage<TermState> termStorage,
StateStorage<VoteState> voteStorage,
RaftLog entryLog,
long electionTimeout,
long heartbeatInterval,
RenewableTimeoutService renewableTimeoutService,
Outbound<MemberId,RaftMessages.RaftMessage> outbound,
org.neo4j.logging.LogProvider logProvider,
RaftMembershipManager membershipManager,
RaftLogShippingManager logShipping,
InFlightMap<RaftLogEntry> inFlightMap,
boolean refuseToBecomeLeader,
org.neo4j.kernel.monitoring.Monitors monitors,
Clock clock) |
| Modifier and Type | Method and Description |
|---|---|
RaftCoreState |
coreState() |
Role |
currentRole() |
MemberId |
getLeader() |
ConsensusOutcome |
handle(RaftMessages.RaftMessage incomingMessage) |
MemberId |
identity() |
void |
installCoreState(RaftCoreState coreState) |
boolean |
isLeader() |
RaftLogShippingManager |
logShippingManager() |
void |
panic() |
void |
postRecoveryActions()
This should be called after the major recovery operations are complete.
|
void |
registerListener(org.neo4j.kernel.impl.util.Listener<MemberId> listener) |
Set<MemberId> |
replicationMembers() |
void |
setTargetMembershipSet(Set<MemberId> targetMembers) |
ExposedRaftState |
state()
Every call to state() gives you an immutable copy of the current state.
|
void |
stopTimers() |
long |
term() |
String |
toString() |
void |
triggerElection() |
void |
unregisterListener(org.neo4j.kernel.impl.util.Listener listener) |
Set<MemberId> |
votingMembers() |
public RaftMachine(MemberId myself, StateStorage<TermState> termStorage, StateStorage<VoteState> voteStorage, RaftLog entryLog, long electionTimeout, long heartbeatInterval, RenewableTimeoutService renewableTimeoutService, Outbound<MemberId,RaftMessages.RaftMessage> outbound, org.neo4j.logging.LogProvider logProvider, RaftMembershipManager membershipManager, RaftLogShippingManager logShipping, InFlightMap<RaftLogEntry> inFlightMap, boolean refuseToBecomeLeader, org.neo4j.kernel.monitoring.Monitors monitors, Clock clock)
public void postRecoveryActions()
public void stopTimers()
public void triggerElection()
throws IOException
IOExceptionpublic void panic()
public RaftCoreState coreState()
public void installCoreState(RaftCoreState coreState) throws IOException
IOExceptionpublic MemberId getLeader() throws NoLeaderFoundException
getLeader in interface LeaderLocatorNoLeaderFoundExceptionpublic void registerListener(org.neo4j.kernel.impl.util.Listener<MemberId> listener)
registerListener in interface LeaderLocatorpublic void unregisterListener(org.neo4j.kernel.impl.util.Listener listener)
unregisterListener in interface LeaderLocatorpublic ExposedRaftState state()
public ConsensusOutcome handle(RaftMessages.RaftMessage incomingMessage) throws IOException
IOExceptionpublic boolean isLeader()
isLeader in interface CoreMetaDatapublic Role currentRole()
public MemberId identity()
public RaftLogShippingManager logShippingManager()
public long term()
Copyright © 2002–2017 The Neo4j Graph Database Project. All rights reserved.