public class LeaderState extends Object
nextIndex: index of the next log entry to send to that server
(initialized to leader's lastLogIndex + 1)matchIndex: index of highest log entry known to be replicated
on server (initialized to 0, increases monotonically)| Modifier and Type | Method and Description |
|---|---|
void |
add(Endpoint follower,
long lastLogIndex)
Add a new follower with the leader's
lastLogIndex. |
long |
getMatchIndex(Endpoint follower)
Returns the
matchIndex for a known follower. |
long |
getNextIndex(Endpoint follower)
Returns the
nextIndex for a known follower. |
Collection<Long> |
matchIndices() |
void |
remove(Endpoint follower)
Removes a follower from leader maintained state.
|
void |
setMatchIndex(Endpoint follower,
long index)
Sets
matchIndex for a known follower. |
void |
setNextIndex(Endpoint follower,
long index)
Sets
nextIndex for a known follower. |
public void add(Endpoint follower, long lastLogIndex)
lastLogIndex.
Follower's nextIndex will be set to lastLogIndex + 1
and matchIndex to 0.public void remove(Endpoint follower)
public void setNextIndex(Endpoint follower, long index)
nextIndex for a known follower.public void setMatchIndex(Endpoint follower, long index)
matchIndex for a known follower.public Collection<Long> matchIndices()
public long getNextIndex(Endpoint follower)
nextIndex for a known follower.public long getMatchIndex(Endpoint follower)
matchIndex for a known follower.Copyright © 2019. All Rights Reserved.