public abstract class RaftOp extends Object implements DataSerializable
RaftOp
is stored in Raft log by leader and replicated to followers.
When at least majority of the members append it to their logs,
the log entry which it belongs is committed and RaftOp
is executed
eventually on each member.
Note that, implementations of RaftOp
must be deterministic.
They should perform the same action and produce the same result always,
independent of where and when they are executed.
run(CPGroupId, long)
method must be implemented by subclasses.
Constructor and Description |
---|
RaftOp() |
Modifier and Type | Method and Description |
---|---|
protected ILogger |
getLogger() |
NodeEngine |
getNodeEngine() |
<T> T |
getService() |
protected abstract String |
getServiceName() |
void |
logFailure(Throwable e) |
abstract Object |
run(CPGroupId groupId,
long commitIndex)
Contains actual Raft operation logic.
|
RaftOp |
setNodeEngine(NodeEngine nodeEngine) |
String |
toString() |
protected void |
toString(StringBuilder sb) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
readData, writeData
public abstract Object run(CPGroupId groupId, long commitIndex) throws Exception
groupId
- groupId of the specific Raft groupcommitIndex
- commitIndex of the log entry keeping this operationException
public NodeEngine getNodeEngine()
public RaftOp setNodeEngine(NodeEngine nodeEngine)
public <T> T getService()
protected ILogger getLogger()
protected abstract String getServiceName()
public void logFailure(Throwable e)
protected void toString(StringBuilder sb)
Copyright © 2021 Hazelcast, Inc.. All Rights Reserved.