@ThreadSafe public class BallotBox extends Object implements Lifecycle<BallotBoxOptions>, Describer
Describer.DefaultPrinter, Describer.Printer| 构造器和说明 |
|---|
BallotBox() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
appendPendingTask(Configuration conf,
Configuration oldConf,
Closure done)
Called by leader, otherwise the behavior is undefined
Store application context before replication.
|
void |
clearPendingTasks()
Called when the leader steps down, otherwise the behavior is undefined
When a leader steps down, the uncommitted user applications should
fail immediately, which the new leader will deal whether to commit or
truncate.
|
boolean |
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|.
|
void |
describe(Describer.Printer out) |
long |
getLastCommittedIndex() |
boolean |
init(BallotBoxOptions opts)
Initialize the service.
|
boolean |
resetPendingIndex(long newPendingIndex)
Called when a candidate becomes the new leader, otherwise the behavior is
undefined.
|
boolean |
setLastCommittedIndex(long lastCommittedIndex)
Called by follower, otherwise the behavior is undefined.
|
void |
shutdown()
Dispose the resources for service.
|
public long getLastCommittedIndex()
public boolean init(BallotBoxOptions opts)
Lifecycleinit 在接口中 Lifecycle<BallotBoxOptions>public boolean commitAt(long firstLogIndex,
long lastLogIndex,
PeerId peer)
public void clearPendingTasks()
public boolean resetPendingIndex(long newPendingIndex)
newPendingIndex - pending index of new leaderpublic boolean appendPendingTask(Configuration conf, Configuration oldConf, Closure done)
conf - current configurationoldConf - old configurationdone - callbackpublic boolean setLastCommittedIndex(long lastCommittedIndex)
lastCommittedIndex - last committed indexpublic void shutdown()
Lifecycleshutdown 在接口中 Lifecycle<BallotBoxOptions>public void describe(Describer.Printer out)
Copyright © 2021. All rights reserved.