mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: simplify raftLog.lastIndex
This commit is contained in:
parent
8670f4012b
commit
7fcaca6d18
@ -158,14 +158,7 @@ func (l *raftLog) firstIndex() uint64 {
|
||||
}
|
||||
|
||||
func (l *raftLog) lastIndex() uint64 {
|
||||
if len(l.unstableEnts) > 0 {
|
||||
return l.unstable + uint64(len(l.unstableEnts)) - 1
|
||||
}
|
||||
index, err := l.storage.LastIndex()
|
||||
if err != nil {
|
||||
panic(err) // TODO(bdarnell)
|
||||
}
|
||||
return index
|
||||
return l.unstable + uint64(len(l.unstableEnts)) - 1
|
||||
}
|
||||
|
||||
func (l *raftLog) commitTo(tocommit uint64) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user