firstEmptySlot returns the index of the first empty slot in the file.
()
| 189 | |
| 190 | // firstEmptySlot returns the index of the first empty slot in the file. |
| 191 | func (lf *logFile) firstEmptySlot() int { |
| 192 | return sort.Search(maxNumEntries, func(i int) bool { |
| 193 | e := lf.getEntry(i) |
| 194 | return e.Index() == 0 |
| 195 | }) |
| 196 | } |
| 197 | |
| 198 | // lastEntry returns the last valid entry in the file. |
| 199 | func (lf *logFile) lastEntry() entry { |