Search in sources :

Example 1 with SegmentedRaftLog

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;
}
Also used : MemoryRaftLog(org.apache.ratis.server.raftlog.memory.MemoryRaftLog) SegmentedRaftLog(org.apache.ratis.server.raftlog.segmented.SegmentedRaftLog) RaftLog(org.apache.ratis.server.raftlog.RaftLog) SegmentedRaftLog(org.apache.ratis.server.raftlog.segmented.SegmentedRaftLog) MemoryRaftLog(org.apache.ratis.server.raftlog.memory.MemoryRaftLog)

Aggregations

RaftLog (org.apache.ratis.server.raftlog.RaftLog)1 MemoryRaftLog (org.apache.ratis.server.raftlog.memory.MemoryRaftLog)1 SegmentedRaftLog (org.apache.ratis.server.raftlog.segmented.SegmentedRaftLog)1