MCPcopy
hub / github.com/coocood/freecache / nextForSegment

Method nextForSegment

iterator.go:38–51  ·  view source on GitHub ↗
(segIdx int)

Source from the content-addressed store, hash-verified

36}
37
38func (it *Iterator) nextForSegment(segIdx int) *Entry {
39 it.cache.locks[segIdx].Lock()
40 defer it.cache.locks[segIdx].Unlock()
41 seg := &it.cache.segments[segIdx]
42 for it.slotIdx < 256 {
43 entry := it.nextForSlot(seg, it.slotIdx)
44 if entry != nil {
45 return entry
46 }
47 it.slotIdx++
48 it.entryIdx = 0
49 }
50 return nil
51}
52
53func (it *Iterator) nextForSlot(seg *segment, slotId int) *Entry {
54 slotOff := int32(it.slotIdx) * seg.slotCap

Callers 1

NextMethod · 0.95

Calls 1

nextForSlotMethod · 0.95

Tested by

no test coverage detected