MCPcopy Create free account
hub / github.com/allegro/bigcache / setCurrentEntry

Method setCurrentEntry

iterator.go:103–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101}
102
103func (it *EntryInfoIterator) setCurrentEntry() bool {
104 var entryNotFound = false
105 entry, err := it.cache.shards[it.currentShard].getEntry(it.elements[it.currentIndex])
106
107 if err == ErrEntryNotFound {
108 it.currentEntryInfo = emptyEntryInfo
109 entryNotFound = true
110 } else if err != nil {
111 it.currentEntryInfo = EntryInfo{
112 err: err,
113 }
114 } else {
115 it.currentEntryInfo = EntryInfo{
116 timestamp: readTimestampFromEntry(entry),
117 hash: readHashFromEntry(entry),
118 key: readKeyFromEntry(entry),
119 value: readEntry(entry),
120 err: err,
121 }
122 }
123
124 return entryNotFound
125}
126
127func newIterator(cache *BigCache) *EntryInfoIterator {
128 elements, count := cache.shards[0].copyHashedKeys()

Callers 1

SetNextMethod · 0.95

Calls 5

readTimestampFromEntryFunction · 0.85
readHashFromEntryFunction · 0.85
readKeyFromEntryFunction · 0.85
readEntryFunction · 0.85
getEntryMethod · 0.80

Tested by

no test coverage detected