use of org.apache.ratis.server.raftlog.segmented.SegmentedRaftLog 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;
}
Aggregations