type unstable … // maybeFirstIndex returns the index of the first possible entry in entries // if it has a snapshot. func (u *unstable) maybeFirstIndex() (uint64, bool) { … } // maybeLastIndex returns the last index if it has at least one // unstable entry or snapshot. func (u *unstable) maybeLastIndex() (uint64, bool) { … } // maybeTerm returns the term of the entry at index i, if there // is any. func (u *unstable) maybeTerm(i uint64) (uint64, bool) { … } func (u *unstable) stableTo(i, t uint64) { … } // shrinkEntriesArray discards the underlying array used by the entries slice // if most of it isn't being used. This avoids holding references to a bunch of // potentially large entries that aren't needed anymore. Simply clearing the // entries wouldn't be safe because clients might still be using them. func (u *unstable) shrinkEntriesArray() { … } func (u *unstable) stableSnapTo(i uint64) { … } func (u *unstable) restore(s pb.Snapshot) { … } func (u *unstable) truncateAndAppend(ents []pb.Entry) { … } func (u *unstable) slice(lo uint64, hi uint64) []pb.Entry { … } // u.offset <= lo <= hi <= u.offset+len(u.entries) func (u *unstable) mustCheckOutOfBounds(lo, hi uint64) { … }