use of org.apache.ratis.server.raftlog.memory.MemoryRaftLog in project incubator-ratis by apache.
the class ServerState method initRaftLog.
private static RaftLog initRaftLog(RaftGroupMemberId memberId, RaftServerImpl server, RaftStorage storage, Consumer<LogEntryProto> logConsumer, LongSupplier getSnapshotIndexFromStateMachine, RaftProperties prop) throws IOException {
final RaftLog log;
if (RaftServerConfigKeys.Log.useMemory(prop)) {
log = new MemoryRaftLog(memberId, getSnapshotIndexFromStateMachine, prop);
} else {
log = new SegmentedRaftLog(memberId, server, server.getStateMachine(), server::notifyTruncatedLogEntry, server::submitUpdateCommitEvent, storage, getSnapshotIndexFromStateMachine, prop);
}
log.open(log.getSnapshotIndex(), logConsumer);
return log;
}
use of org.apache.ratis.server.raftlog.memory.MemoryRaftLog in project incubator-ratis by apache.
the class MiniRaftCluster method printAllLogs.
public String printAllLogs() {
StringBuilder b = new StringBuilder("\n#servers = " + servers.size() + "\n");
for (RaftServer.Division s : iterateDivisions()) {
b.append(" ");
b.append(s).append("\n");
final RaftLog log = s.getRaftLog();
if (log instanceof MemoryRaftLog) {
b.append(" ");
b.append(((MemoryRaftLog) log).getEntryString());
}
}
return b.toString();
}
Aggregations