@ThreadSafe public class Replicator extends Object implements ThreadId.OnError
| Modifier and Type | Class and Description |
|---|---|
static interface |
Replicator.ReplicatorStateListener
User can implement the ReplicatorStateListener interface by themselves.
|
static class |
Replicator.State
Replicator internal state
|
| Modifier and Type | Field and Description |
|---|---|
protected ThreadId |
id |
protected com.alipay.sofa.jraft.core.Replicator.Stat |
statInfo |
| Constructor and Description |
|---|
Replicator(ReplicatorOptions replicatorOptions,
RaftOptions raftOptions) |
| Modifier and Type | Method and Description |
|---|---|
static long |
getLastRpcSendTimestamp(ThreadId id) |
static long |
getNextIndex(ThreadId id) |
PriorityQueue<com.alipay.sofa.jraft.core.Replicator.RpcResponse> |
getPendingResponses() |
static boolean |
join(ThreadId id) |
void |
onError(ThreadId id,
Object data,
int errorCode)
Error callback, it will be called in lock.
|
static void |
sendHeartbeat(ThreadId id,
RpcResponseClosure<RpcRequests.AppendEntriesResponse> closure) |
static boolean |
sendTimeoutNowAndStop(ThreadId id,
int timeoutMs) |
static ThreadId |
start(ReplicatorOptions opts,
RaftOptions raftOptions) |
static boolean |
stop(ThreadId id) |
static boolean |
stopTransferLeadership(ThreadId id) |
String |
toString() |
static boolean |
transferLeadership(ThreadId id,
long logIndex) |
static void |
waitForCaughtUp(String groupId,
ThreadId id,
long maxMargin,
long dueTime,
CatchUpClosure done) |
protected com.alipay.sofa.jraft.core.Replicator.Stat statInfo
protected ThreadId id
public Replicator(ReplicatorOptions replicatorOptions, RaftOptions raftOptions)
@OnlyForTest public PriorityQueue<com.alipay.sofa.jraft.core.Replicator.RpcResponse> getPendingResponses()
public static ThreadId start(ReplicatorOptions opts, RaftOptions raftOptions)
public static void waitForCaughtUp(String groupId, ThreadId id, long maxMargin, long dueTime, CatchUpClosure done)
public void onError(ThreadId id, Object data, int errorCode)
ThreadId.OnErroronError in interface ThreadId.OnErrorid - the thread iddata - the dataerrorCode - the error codepublic static void sendHeartbeat(ThreadId id, RpcResponseClosure<RpcRequests.AppendEntriesResponse> closure)
public static boolean stop(ThreadId id)
public static boolean join(ThreadId id)
public static long getLastRpcSendTimestamp(ThreadId id)
public static boolean transferLeadership(ThreadId id, long logIndex)
public static boolean stopTransferLeadership(ThreadId id)
public static boolean sendTimeoutNowAndStop(ThreadId id, int timeoutMs)
public static long getNextIndex(ThreadId id)
Copyright © 2024. All rights reserved.