mirror of
https://github.com/talent-plan/tinykv.git
synced 2024-12-26 12:50:11 +08:00
add a new interface allEntries to RaftLog (#418)
This commit is contained in:
parent
6df022c85d
commit
cfbc05df7e
@ -66,6 +66,14 @@ func (l *RaftLog) maybeCompact() {
|
||||
// Your Code Here (2C).
|
||||
}
|
||||
|
||||
// allEntries return all the entries not compacted.
|
||||
// note, exclude any dummy entries from the return value.
|
||||
// note, this is one of the test stub functions you need to implement.
|
||||
func (l *RaftLog) allEntries() []pb.Entry {
|
||||
// Your Code Here (2A).
|
||||
return nil
|
||||
}
|
||||
|
||||
// unstableEntries return all the unstable entries
|
||||
func (l *RaftLog) unstableEntries() []pb.Entry {
|
||||
// Your Code Here (2A).
|
||||
|
@ -659,7 +659,7 @@ func TestFollowerAppendEntries2AB(t *testing.T) {
|
||||
for _, ent := range tt.wents {
|
||||
wents = append(wents, *ent)
|
||||
}
|
||||
if g := r.RaftLog.entries; !reflect.DeepEqual(g, wents) {
|
||||
if g := r.RaftLog.allEntries(); !reflect.DeepEqual(g, wents) {
|
||||
t.Errorf("#%d: ents = %+v, want %+v", i, g, wents)
|
||||
}
|
||||
var wunstable []pb.Entry
|
||||
|
Loading…
Reference in New Issue
Block a user