public abstract class RaftLogBase extends Object implements RaftLog
| Modifier and Type | Class and Description |
|---|---|
static class |
RaftLogSequentialOps.Runner |
RaftLog.EntryWithData| Modifier and Type | Field and Description |
|---|---|
static long |
INVALID_LOG_INDEX |
static long |
LEAST_VALID_LOG_INDEX
The least valid log index, i.e.
|
| Modifier | Constructor and Description |
|---|---|
protected |
RaftLogBase(RaftGroupMemberId memberId,
LongSupplier getSnapshotIndexFromStateMachine,
RaftProperties properties) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontains, get, getEntries, getEntryWithData, getFlushIndex, getLastEntryTermIndex, getNextIndex, getRaftLogMetrics, getStartIndex, getTermIndex, loadMetadata, onSnapshotInstalled, persistMetadatapublic static final long LEAST_VALID_LOG_INDEX
public static final long INVALID_LOG_INDEX
protected RaftLogBase(RaftGroupMemberId memberId, LongSupplier getSnapshotIndexFromStateMachine, RaftProperties properties)
public long getLastCommittedIndex()
getLastCommittedIndex in interface RaftLogpublic long getSnapshotIndex()
getSnapshotIndex in interface RaftLogpublic void checkLogState()
public boolean isOpened()
public boolean updateCommitIndex(long majorityIndex,
long currentTerm,
boolean isLeader)
updateCommitIndex in interface RaftLogprotected void updateSnapshotIndexFromStateMachine()
public void updateSnapshotIndex(long newSnapshotIndex)
updateSnapshotIndex in interface RaftLogpublic final long append(long term,
TransactionContext transaction)
throws StateMachineException
StateMachineExceptionpublic final long appendMetadata(long term,
long newCommitIndex)
public final long append(long term,
RaftConfiguration configuration)
public final void open(long lastIndexInSnapshot,
Consumer<org.apache.ratis.proto.RaftProtos.LogEntryProto> consumer)
throws IOException
open in interface RaftLogIOExceptionprotected void openImpl(long lastIndexInSnapshot,
Consumer<org.apache.ratis.proto.RaftProtos.LogEntryProto> consumer)
throws IOException
IOExceptionprotected void validateLogEntry(org.apache.ratis.proto.RaftProtos.LogEntryProto entry)
public final CompletableFuture<Long> truncate(long index)
protected abstract CompletableFuture<Long> truncateImpl(long index)
public final CompletableFuture<Long> purge(long suggestedIndex)
protected abstract CompletableFuture<Long> purgeImpl(long index)
public final CompletableFuture<Long> appendEntry(org.apache.ratis.proto.RaftProtos.LogEntryProto entry)
protected abstract CompletableFuture<Long> appendEntryImpl(org.apache.ratis.proto.RaftProtos.LogEntryProto entry)
public final List<CompletableFuture<Long>> append(List<org.apache.ratis.proto.RaftProtos.LogEntryProto> entries)
protected abstract List<CompletableFuture<Long>> appendImpl(List<org.apache.ratis.proto.RaftProtos.LogEntryProto> entries)
public AutoCloseableLock readLock()
public AutoCloseableLock writeLock()
public boolean hasWriteLock()
public boolean hasReadLock()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic String getName()
protected RaftLog.EntryWithData newEntryWithData(org.apache.ratis.proto.RaftProtos.LogEntryProto logEntry, CompletableFuture<org.apache.ratis.thirdparty.com.google.protobuf.ByteString> future)
public String toLogEntryString(org.apache.ratis.proto.RaftProtos.LogEntryProto logEntry)
@Deprecated public List<CompletableFuture<Long>> append(org.apache.ratis.proto.RaftProtos.LogEntryProto... arg0)
Copyright © 2017–2023 The Apache Software Foundation. All rights reserved.