Next returns the next entry for the iterator. The order of the entries is not guaranteed. If there is no more entries to return, nil will be returned.
()
| 23 | // The order of the entries is not guaranteed. |
| 24 | // If there is no more entries to return, nil will be returned. |
| 25 | func (it *Iterator) Next() *Entry { |
| 26 | for it.segmentIdx < 256 { |
| 27 | entry := it.nextForSegment(it.segmentIdx) |
| 28 | if entry != nil { |
| 29 | return entry |
| 30 | } |
| 31 | it.segmentIdx++ |
| 32 | it.slotIdx = 0 |
| 33 | it.entryIdx = 0 |
| 34 | } |
| 35 | return nil |
| 36 | } |
| 37 | |
| 38 | func (it *Iterator) nextForSegment(segIdx int) *Entry { |
| 39 | it.cache.locks[segIdx].Lock() |