public interface LogAppender
LogAppender is for the leader to send appendEntries to a particular follower.| 限定符和类型 | 字段和说明 |
|---|---|
static Class<? extends LogAppender> |
DEFAULT_CLASS |
static org.slf4j.Logger |
LOG |
| 限定符和类型 | 方法和说明 |
|---|---|
long |
getCallId() |
Comparator<Long> |
getCallIdComparator() |
AwaitForSignal |
getEventAwaitForSignal()
Get the
AwaitForSignal for events, which can be:
(1) new log entries available,
(2) log indices changed, or
(3) a snapshot installation completed. |
FollowerInfo |
getFollower() |
default RaftPeerId |
getFollowerId()
The same as getFollower().getPeer().getId().
|
default long |
getHeartbeatWaitTimeMs() |
LeaderState |
getLeaderState() |
default RaftLog |
getRaftLog()
The same as getServer().getRaftLog().
|
RaftServer.Division |
getServer() |
default RaftServerRpc |
getServerRpc()
The same as getServer().getRaftServer().getServerRpc().
|
default boolean |
hasAppendEntries()
Does it have outstanding appendEntries?
|
boolean |
isRunning()
Is this
LogAppender running? |
org.apache.ratis.proto.RaftProtos.AppendEntriesRequestProto |
newAppendEntriesRequest(long callId,
boolean heartbeat)
|
org.apache.ratis.proto.RaftProtos.InstallSnapshotRequestProto |
newInstallSnapshotNotificationRequest(TermIndex firstAvailableLogTermIndex) |
Iterable<org.apache.ratis.proto.RaftProtos.InstallSnapshotRequestProto> |
newInstallSnapshotRequests(String requestId,
SnapshotInfo snapshot) |
static LogAppender |
newLogAppenderDefault(RaftServer.Division server,
LeaderState leaderState,
FollowerInfo f)
Create the default
LogAppender. |
default void |
notifyLogAppender()
The same as getEventAwaitForSignal().signal().
|
default boolean |
onFollowerTerm(long followerTerm)
Handle the event that the follower has replied a term.
|
void |
run()
Define how this
LogAppender should run. |
default SnapshotInfo |
shouldInstallSnapshot()
Should this
LogAppender send a snapshot to the follower? |
default boolean |
shouldSendAppendEntries()
Should the leader send appendEntries RPC to the follower?
|
void |
start()
Start this
LogAppender. |
default void |
stop()
已过时。
override
stopAsync() instead. |
default CompletableFuture<?> |
stopAsync()
Stop this
LogAppender asynchronously. |
void |
triggerHeartbeat()
Trigger to send a heartbeat AppendEntries.
|
static final org.slf4j.Logger LOG
static final Class<? extends LogAppender> DEFAULT_CLASS
static LogAppender newLogAppenderDefault(RaftServer.Division server, LeaderState leaderState, FollowerInfo f)
LogAppender.RaftServer.Division getServer()
default RaftServerRpc getServerRpc()
default RaftLog getRaftLog()
void start()
LogAppender.boolean isRunning()
LogAppender running?@Deprecated default void stop()
stopAsync() instead.LogAppender asynchronously.default CompletableFuture<?> stopAsync()
LogAppender asynchronously.LeaderState getLeaderState()
FollowerInfo getFollower()
LogAppender.default RaftPeerId getFollowerId()
long getCallId()
RaftProtos.AppendEntriesRequestProto.Comparator<Long> getCallIdComparator()
Comparator for comparing call ids.org.apache.ratis.proto.RaftProtos.AppendEntriesRequestProto newAppendEntriesRequest(long callId, boolean heartbeat) throws RaftLogIOException
RaftProtos.AppendEntriesRequestProto object using the FollowerInfo of this LogAppender.
The RaftProtos.AppendEntriesRequestProto object may contain zero or more log entries.
When there is zero log entries, the RaftProtos.AppendEntriesRequestProto object is a heartbeat.callId - The call id of the returned request.heartbeat - the returned request must be a heartbeat.RaftProtos.AppendEntriesRequestProto object.RaftLogIOExceptionorg.apache.ratis.proto.RaftProtos.InstallSnapshotRequestProto newInstallSnapshotNotificationRequest(TermIndex firstAvailableLogTermIndex)
RaftProtos.InstallSnapshotRequestProto object.Iterable<org.apache.ratis.proto.RaftProtos.InstallSnapshotRequestProto> newInstallSnapshotRequests(String requestId, SnapshotInfo snapshot)
Iterable of RaftProtos.InstallSnapshotRequestProto for sending the given snapshot.default SnapshotInfo shouldInstallSnapshot()
LogAppender send a snapshot to the follower?void run() throws InterruptedException, IOException
LogAppender should run.AwaitForSignal getEventAwaitForSignal()
AwaitForSignal for events, which can be:
(1) new log entries available,
(2) log indices changed, or
(3) a snapshot installation completed.default void notifyLogAppender()
default boolean shouldSendAppendEntries()
default boolean hasAppendEntries()
void triggerHeartbeat()
default long getHeartbeatWaitTimeMs()
default boolean onFollowerTerm(long followerTerm)
Copyright © 2017–2025 The Apache Software Foundation. All rights reserved.