public class ReplicatorGroupImpl extends Object implements ReplicatorGroup
Describer.DefaultPrinter, Describer.Printer| 构造器和说明 |
|---|
ReplicatorGroupImpl() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
addReplicator(PeerId peer,
ReplicatorType replicatorType,
boolean sync)
Try to add a replicator attached with |peer|
will be a notification when the replicator catches up according to the
arguments.
|
void |
checkReplicator(PeerId peer,
boolean lockNode)
Check replicator state, if it's not started, start it;
if it is blocked, unblock it.
|
void |
clearFailureReplicators()
Clear failure to start replicators
|
boolean |
contains(PeerId peer)
Returns true if the there's a replicator attached to the given |peer|
|
void |
describe(Describer.Printer out) |
PeerId |
findTheNextCandidate(ConfigurationEntry conf)
Find the follower with the most log entries in this group, which is
likely becomes the leader according to the election algorithm of raft.
|
long |
getLastRpcSendTimestamp(PeerId peer)
Get peer's last rpc send timestamp (monotonic time in milliseconds).
|
ThreadId |
getReplicator(PeerId peer)
Get replicator id by peer, null if not found.
|
boolean |
init(NodeId nodeId,
ReplicatorGroupOptions opts)
Init the replicator group.
|
List<ThreadId> |
listReplicators()
Returns all replicators.
|
boolean |
resetElectionTimeoutInterval(int newIntervalMs)
Reset the interval of electionTimeout for replicator.
|
boolean |
resetHeartbeatInterval(int newIntervalMs)
Reset the interval of heartbeat,
This method is supposed to be called when the very candidate becomes the
leader, so we suppose that there are no running replicators.
|
boolean |
resetTerm(long newTerm)
Reset the term of all to-add replicators.
|
void |
sendHeartbeat(PeerId peer,
RpcResponseClosure<RpcRequests.AppendEntriesResponse> closure)
Send heartbeat to a peer.
|
boolean |
stopAll()
Stop all replicators.
|
ThreadId |
stopAllAndFindTheNextCandidate(ConfigurationEntry conf)
Stop all the replicators except for the one that we think can be the
candidate of the next leader, which has the largest `last_log_id' among
peers in |current_conf|.
|
boolean |
stopReplicator(PeerId peer)
Stop replicator for the peer.
|
boolean |
stopTransferLeadership(PeerId peer)
Stop transferring leadership to the given |peer|
|
boolean |
transferLeadershipTo(PeerId peer,
long logIndex)
Transfer leadership to the given |peer|
|
boolean |
waitCaughtUp(PeerId peer,
long maxMargin,
long dueTime,
CatchUpClosure done)
Wait the peer catchup.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddReplicator, addReplicatorpublic boolean init(NodeId nodeId, ReplicatorGroupOptions opts)
ReplicatorGroupinit 在接口中 ReplicatorGroupnodeId - node idopts - options of replicator groppublic void sendHeartbeat(PeerId peer, RpcResponseClosure<RpcRequests.AppendEntriesResponse> closure)
ReplicatorGroupsendHeartbeat 在接口中 ReplicatorGrouppeer - target peerclosure - callbackpublic ThreadId getReplicator(PeerId peer)
ReplicatorGroupgetReplicator 在接口中 ReplicatorGrouppeer - peer of replicatorpublic boolean addReplicator(PeerId peer, ReplicatorType replicatorType, boolean sync)
ReplicatorGroupaddReplicator 在接口中 ReplicatorGrouppeer - target peerreplicatorType - replicator typesync - synchronouspublic void clearFailureReplicators()
ReplicatorGroupclearFailureReplicators 在接口中 ReplicatorGrouppublic boolean waitCaughtUp(PeerId peer, long maxMargin, long dueTime, CatchUpClosure done)
ReplicatorGroupwaitCaughtUp 在接口中 ReplicatorGrouppublic long getLastRpcSendTimestamp(PeerId peer)
ReplicatorGroupgetLastRpcSendTimestamp 在接口中 ReplicatorGrouppeer - the peer of replicatorpublic boolean stopAll()
ReplicatorGroupstopAll 在接口中 ReplicatorGrouppublic void checkReplicator(PeerId peer, boolean lockNode)
ReplicatorGroupcheckReplicator 在接口中 ReplicatorGrouppeer - peer of replicatorlockNode - if lock with nodepublic boolean stopReplicator(PeerId peer)
ReplicatorGroupstopReplicator 在接口中 ReplicatorGrouppeer - the peer of replicatorpublic boolean resetTerm(long newTerm)
ReplicatorGroupresetTerm 在接口中 ReplicatorGroupnewTerm - new term numpublic boolean resetHeartbeatInterval(int newIntervalMs)
ReplicatorGroupresetHeartbeatInterval 在接口中 ReplicatorGroupnewIntervalMs - new heartbeat interval millispublic boolean resetElectionTimeoutInterval(int newIntervalMs)
ReplicatorGroupresetElectionTimeoutInterval 在接口中 ReplicatorGroupnewIntervalMs - new election timeout millispublic boolean contains(PeerId peer)
ReplicatorGroupcontains 在接口中 ReplicatorGrouppeer - target peerpublic boolean transferLeadershipTo(PeerId peer, long logIndex)
ReplicatorGrouptransferLeadershipTo 在接口中 ReplicatorGrouppeer - target peerlogIndex - log indexpublic boolean stopTransferLeadership(PeerId peer)
ReplicatorGroupstopTransferLeadership 在接口中 ReplicatorGrouppeer - target peerpublic ThreadId stopAllAndFindTheNextCandidate(ConfigurationEntry conf)
ReplicatorGroupstopAllAndFindTheNextCandidate 在接口中 ReplicatorGroupconf - configuration of all replicatorspublic PeerId findTheNextCandidate(ConfigurationEntry conf)
ReplicatorGroupfindTheNextCandidate 在接口中 ReplicatorGroupconf - configuration of all replicatorspublic List<ThreadId> listReplicators()
ReplicatorGrouplistReplicators 在接口中 ReplicatorGrouppublic void describe(Describer.Printer out)
Copyright © 2021. All rights reserved.