| 限定符和类型 | 方法和说明 |
|---|---|
PeerId |
ReplicatorGroup.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.
|
PeerId |
Node.getLeaderId()
Get the leader peer id for redirect, null if absent.
|
static PeerId |
JRaftUtils.getPeerId(String s)
Create a peer from a string in the form of "host:port[:idx]",
returns a empty peer when string is blank.
|
PeerId |
RaftGroupService.getServerId()
Returns the node serverId
|
PeerId |
RouteTable.selectLeader(String groupId)
Get the cached leader of the group, return it when found, null otherwise.
|
| 限定符和类型 | 方法和说明 |
|---|---|
List<PeerId> |
CliService.getAliveLearners(String groupId,
Configuration conf)
Ask all alive learners of the replication group.
|
List<PeerId> |
CliService.getAlivePeers(String groupId,
Configuration conf)
Ask all alive peers of the replication group.
|
List<PeerId> |
CliService.getLearners(String groupId,
Configuration conf)
Ask all learners of the replication group.
|
List<PeerId> |
CliService.getPeers(String groupId,
Configuration conf)
Ask all peers of the replication group.
|
List<PeerId> |
Node.listAliveLearners()
List all alive learners of this raft group, only leader returns.
|
List<PeerId> |
Node.listAlivePeers()
List all alive peers of this raft group, only leader returns.
|
List<PeerId> |
Node.listLearners()
List all learners of this raft group, only leader returns.
|
List<PeerId> |
Node.listPeers()
List peers of this raft group, only leader returns.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
Node.addPeer(PeerId peer,
Closure done)
Add a new peer to the raft group. done.run() would be invoked after this
operation finishes, describing the detailed result.
|
Status |
CliService.addPeer(String groupId,
Configuration conf,
PeerId peer)
Add a new peer into the replicating group which consists of |conf|.
|
default boolean |
ReplicatorGroup.addReplicator(PeerId peer)
Adds a replicator for follower(
ReplicatorType.Follower). |
default boolean |
ReplicatorGroup.addReplicator(PeerId peer,
ReplicatorType replicatorType)
Add a replicator attached with |peer|
will be a notification when the replicator catches up according to the
arguments.
|
boolean |
ReplicatorGroup.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 |
ReplicatorGroup.checkReplicator(PeerId peer,
boolean lockNode)
Check replicator state, if it's not started, start it;
if it is blocked, unblock it.
|
boolean |
ReplicatorGroup.contains(PeerId peer)
Returns true if the there's a replicator attached to the given |peer|
|
static Node |
RaftServiceFactory.createAndInitRaftNode(String groupId,
PeerId serverId,
NodeOptions opts)
Create and initialize a raft node with node options.
|
static Node |
RaftServiceFactory.createRaftNode(String groupId,
PeerId serverId)
Create a raft node with group id and it's serverId.
|
Node |
NodeManager.get(String groupId,
PeerId peerId)
Get node by groupId and peer.
|
long |
ReplicatorGroup.getLastRpcSendTimestamp(PeerId peer)
Get peer's last rpc send timestamp (monotonic time in milliseconds).
|
Status |
CliService.getLeader(String groupId,
Configuration conf,
PeerId leaderId)
Get the leader of the replication group.
|
ThreadId |
ReplicatorGroup.getReplicator(PeerId peer)
Get replicator id by peer, null if not found.
|
Status |
CliService.learner2Follower(String groupId,
Configuration conf,
PeerId learner)
Converts the specified learner to follower of |conf|.
|
void |
Node.removePeer(PeerId peer,
Closure done)
Remove the peer from the raft group. done.run() would be invoked after
operation finishes, describing the detailed result.
|
Status |
CliService.removePeer(String groupId,
Configuration conf,
PeerId peer)
Remove a peer from the replicating group which consists of |conf|.
|
Status |
CliService.resetPeer(String groupId,
PeerId peer,
Configuration newPeers)
Reset the peer set of the target peer.
|
void |
ReplicatorGroup.sendHeartbeat(PeerId peer,
RpcResponseClosure<RpcRequests.AppendEntriesResponse> closure)
Send heartbeat to a peer.
|
void |
RaftGroupService.setServerId(PeerId serverId)
Set the node serverId
|
Status |
CliService.snapshot(String groupId,
PeerId peer)
Ask the peer to dump a snapshot immediately.
|
boolean |
ReplicatorGroup.stopReplicator(PeerId peer)
Stop replicator for the peer.
|
boolean |
ReplicatorGroup.stopTransferLeadership(PeerId peer)
Stop transferring leadership to the given |peer|
|
Status |
CliService.transferLeader(String groupId,
Configuration conf,
PeerId peer)
Transfer the leader of the replication group to the target peer
|
Status |
Node.transferLeadershipTo(PeerId peer)
Try transferring leadership to |peer|.
|
boolean |
ReplicatorGroup.transferLeadershipTo(PeerId peer,
long logIndex)
Transfer leadership to the given |peer|
|
boolean |
RouteTable.updateLeader(String groupId,
PeerId leader)
Update leader info.
|
boolean |
ReplicatorGroup.waitCaughtUp(PeerId peer,
long maxMargin,
long dueTime,
CatchUpClosure done)
Wait the peer catchup.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
Node.addLearners(List<PeerId> learners,
Closure done)
Add some new learners to the raft group. done.run() will be invoked after this
operation finishes, describing the detailed result.
|
Status |
CliService.addLearners(String groupId,
Configuration conf,
List<PeerId> learners)
Add some new learners into the replicating group which consists of |conf|.
|
Status |
CliService.rebalance(Set<String> balanceGroupIds,
Configuration conf,
Map<String,PeerId> balancedLeaderIds)
Balance the number of leaders.
|
void |
Node.removeLearners(List<PeerId> learners,
Closure done)
Remove some learners from the raft group. done.run() will be invoked after this
operation finishes, describing the detailed result.
|
Status |
CliService.removeLearners(String groupId,
Configuration conf,
List<PeerId> learners)
Remove some learners from the replicating group which consists of |conf|.
|
void |
Node.resetLearners(List<PeerId> learners,
Closure done)
Reset learners in the raft group. done.run() will be invoked after this
operation finishes, describing the detailed result.
|
Status |
CliService.resetLearners(String groupId,
Configuration conf,
List<PeerId> learners)
Update learners set in the replicating group which consists of |conf|.
|
| 构造器和说明 |
|---|
RaftGroupService(String groupId,
PeerId serverId,
NodeOptions nodeOptions) |
RaftGroupService(String groupId,
PeerId serverId,
NodeOptions nodeOptions,
RpcServer rpcServer) |
RaftGroupService(String groupId,
PeerId serverId,
NodeOptions nodeOptions,
RpcServer rpcServer,
boolean sharedRpcServer) |
| 限定符和类型 | 方法和说明 |
|---|---|
LinkedHashSet<PeerId> |
Configuration.getLearners()
Retrieve the learners set.
|
List<PeerId> |
Configuration.getPeers() |
Set<PeerId> |
Configuration.getPeerSet() |
Iterator<PeerId> |
Configuration.iterator() |
List<PeerId> |
Configuration.listLearners()
Retrieve the learners set copy.
|
Set<PeerId> |
ConfigurationEntry.listLearners() |
List<PeerId> |
Configuration.listPeers() |
Set<PeerId> |
ConfigurationEntry.listPeers() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
Configuration.addLearner(PeerId learner)
Add a learner peer.
|
boolean |
Configuration.addPeer(PeerId peer) |
boolean |
Configuration.contains(PeerId peer) |
boolean |
ConfigurationEntry.contains(PeerId peer) |
boolean |
ConfigurationEntry.containsLearner(PeerId learner) |
boolean |
Configuration.removeLearner(PeerId learner)
Remove a learner peer.
|
boolean |
Configuration.removePeer(PeerId peer) |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
Configuration.addLearners(Iterable<PeerId> learners)
Add learners in batch, returns the added count.
|
void |
Configuration.appendPeers(Collection<PeerId> set) |
void |
Configuration.setLearners(LinkedHashSet<PeerId> learners) |
void |
Configuration.setPeers(List<PeerId> peers) |
| 构造器和说明 |
|---|
Configuration(Iterable<PeerId> conf)
Construct a configuration instance with peers.
|
Configuration(Iterable<PeerId> conf,
Iterable<PeerId> learners)
Construct a Configuration instance with peers and learners.
|
Configuration(Iterable<PeerId> conf,
Iterable<PeerId> learners)
Construct a Configuration instance with peers and learners.
|
| 限定符和类型 | 方法和说明 |
|---|---|
PeerId |
ReplicatorGroupImpl.findTheNextCandidate(ConfigurationEntry conf) |
PeerId |
NodeImpl.getLeaderId() |
PeerId |
NodeImpl.getServerId() |
| 限定符和类型 | 方法和说明 |
|---|---|
List<PeerId> |
CliServiceImpl.getAliveLearners(String groupId,
Configuration conf) |
List<PeerId> |
CliServiceImpl.getAlivePeers(String groupId,
Configuration conf) |
List<PeerId> |
CliServiceImpl.getLearners(String groupId,
Configuration conf) |
List<PeerId> |
CliServiceImpl.getPeers(String groupId,
Configuration conf) |
List<PeerId> |
NodeImpl.listAliveLearners() |
List<PeerId> |
NodeImpl.listAlivePeers() |
List<PeerId> |
NodeImpl.listLearners() |
List<PeerId> |
NodeImpl.listPeers() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
NodeImpl.addPeer(PeerId peer,
Closure done) |
Status |
CliServiceImpl.addPeer(String groupId,
Configuration conf,
PeerId peer) |
boolean |
ReplicatorGroupImpl.addReplicator(PeerId peer,
ReplicatorType replicatorType,
boolean sync) |
void |
ReplicatorGroupImpl.checkReplicator(PeerId peer,
boolean lockNode) |
boolean |
BallotBox.commitAt(long firstLogIndex,
long lastLogIndex,
PeerId peer)
Called by leader, otherwise the behavior is undefined
Set logs in [first_log_index, last_log_index] are stable at |peer|.
|
boolean |
ReplicatorGroupImpl.contains(PeerId peer) |
long |
ReplicatorGroupImpl.getLastRpcSendTimestamp(PeerId peer) |
Status |
CliServiceImpl.getLeader(String groupId,
Configuration conf,
PeerId leaderId) |
ThreadId |
ReplicatorGroupImpl.getReplicator(PeerId peer) |
void |
NodeImpl.handlePreVoteResponse(PeerId peerId,
long term,
RpcRequests.RequestVoteResponse response) |
void |
NodeImpl.handleRequestVoteResponse(PeerId peerId,
long term,
RpcRequests.RequestVoteResponse response) |
Status |
CliServiceImpl.learner2Follower(String groupId,
Configuration conf,
PeerId learner) |
void |
Replicator.ReplicatorStateListener.onCreated(PeerId peer)
Called when this replicator has been created.
|
void |
Replicator.ReplicatorStateListener.onDestroyed(PeerId peer)
Called when this replicator has been destroyed.
|
void |
Replicator.ReplicatorStateListener.onError(PeerId peer,
Status status)
Called when this replicator has some errors.
|
void |
NodeImpl.removePeer(PeerId peer,
Closure done) |
Status |
CliServiceImpl.removePeer(String groupId,
Configuration conf,
PeerId peer) |
Status |
CliServiceImpl.resetPeer(String groupId,
PeerId peerId,
Configuration newPeers) |
void |
ReplicatorGroupImpl.sendHeartbeat(PeerId peer,
RpcResponseClosure<RpcRequests.AppendEntriesResponse> closure) |
Status |
CliServiceImpl.snapshot(String groupId,
PeerId peer) |
default void |
Replicator.ReplicatorStateListener.stateChanged(PeerId peer,
Replicator.ReplicatorStateListener.ReplicatorState newState)
Called when the replicator state is changed.
|
boolean |
ReplicatorGroupImpl.stopReplicator(PeerId peer) |
boolean |
ReplicatorGroupImpl.stopTransferLeadership(PeerId peer) |
Status |
CliServiceImpl.transferLeader(String groupId,
Configuration conf,
PeerId peer) |
Status |
NodeImpl.transferLeadershipTo(PeerId peer) |
boolean |
ReplicatorGroupImpl.transferLeadershipTo(PeerId peer,
long logIndex) |
boolean |
ReplicatorGroupImpl.waitCaughtUp(PeerId peer,
long maxMargin,
long dueTime,
CatchUpClosure done) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
NodeImpl.addLearners(List<PeerId> learners,
Closure done) |
Status |
CliServiceImpl.addLearners(String groupId,
Configuration conf,
List<PeerId> learners) |
Status |
CliServiceImpl.rebalance(Set<String> balanceGroupIds,
Configuration conf,
Map<String,PeerId> rebalancedLeaderIds) |
void |
NodeImpl.removeLearners(List<PeerId> learners,
Closure done) |
Status |
CliServiceImpl.removeLearners(String groupId,
Configuration conf,
List<PeerId> learners) |
void |
NodeImpl.resetLearners(List<PeerId> learners,
Closure done) |
Status |
CliServiceImpl.resetLearners(String groupId,
Configuration conf,
List<PeerId> learners) |
| 构造器和说明 |
|---|
NodeImpl(String groupId,
PeerId serverId) |
| 限定符和类型 | 字段和说明 |
|---|---|
static PeerId |
PeerId.ANY_PEER |
| 限定符和类型 | 方法和说明 |
|---|---|
PeerId |
PeerId.copy() |
static PeerId |
PeerId.emptyPeer()
Create an empty peer.
|
PeerId |
LeaderChangeContext.getLeaderId() |
PeerId |
NodeId.getPeerId() |
static PeerId |
PeerId.parsePeer(String s)
Parse a peer from string in the format of "ip:port:idx",
returns null if fail to parse.
|
| 限定符和类型 | 方法和说明 |
|---|---|
List<PeerId> |
LogEntry.getLearners() |
List<PeerId> |
LogEntry.getOldLearners() |
List<PeerId> |
LogEntry.getOldPeers() |
List<PeerId> |
LogEntry.getPeers() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
Ballot.grant(PeerId peerId) |
Ballot.PosHint |
Ballot.grant(PeerId peerId,
Ballot.PosHint hint) |
void |
LeaderChangeContext.setLeaderId(PeerId leaderId) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
LogEntry.setLearners(List<PeerId> learners) |
void |
LogEntry.setOldLearners(List<PeerId> oldLearners) |
void |
LogEntry.setOldPeers(List<PeerId> oldPeers) |
void |
LogEntry.setPeers(List<PeerId> peers) |
| 构造器和说明 |
|---|
LeaderChangeContext(PeerId leaderId,
long term,
Status status) |
NodeId(String groupId,
PeerId peerId) |
UnfoundPeerId(PeerId peerId,
int index,
boolean found) |
| 限定符和类型 | 方法和说明 |
|---|---|
PeerId |
ReplicatorOptions.getPeerId() |
PeerId |
ReplicatorOptions.getServerId() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
ReplicatorOptions.setPeerId(PeerId peerId) |
void |
ReplicatorOptions.setServerId(PeerId serverId) |
| 构造器和说明 |
|---|
ReplicatorOptions(ReplicatorType replicatorType,
int dynamicHeartBeatTimeoutMs,
int electionTimeoutMs,
String groupId,
PeerId serverId,
PeerId peerId,
LogManager logManager,
BallotBox ballotBox,
NodeImpl node,
long term,
SnapshotStorage snapshotStorage,
RaftClientService raftRpcService,
TimerManager timerManager) |
| 限定符和类型 | 字段和说明 |
|---|---|
PeerId |
BaseCliRequestProcessor.CliRequestContext.peerId
The peerId in returns by
BaseCliRequestProcessor.getPeerId(Message), null if absent. |
| 限定符和类型 | 方法和说明 |
|---|---|
protected Node |
BaseCliRequestProcessor.getNode(String groupId,
PeerId peerId,
Status st) |
| 构造器和说明 |
|---|
CliRequestContext(Node ndoe,
String groupId,
PeerId peerId) |
| 限定符和类型 | 方法和说明 |
|---|---|
PeerId |
RaftMetaStorage.getVotedFor()
Get voted for information.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
RaftMetaStorage.setTermAndVotedFor(long term,
PeerId peerId)
Set term and voted for information.
|
boolean |
RaftMetaStorage.setVotedFor(PeerId peerId)
Set voted for information.
|
| 限定符和类型 | 方法和说明 |
|---|---|
PeerId |
LocalRaftMetaStorage.getVotedFor() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
LocalRaftMetaStorage.setTermAndVotedFor(long term,
PeerId peerId) |
boolean |
LocalRaftMetaStorage.setVotedFor(PeerId peerId) |
Copyright © 2021. All rights reserved.