MCPcopy Create free account
hub / github.com/encoder-run/operator / fetchNextBatch

Method fetchNextBatch

pkg/cache/redis/object.go:160–172  ·  view source on GitHub ↗

fetchNextBatch fetches the next batch of keys from Redis matching the object type pattern.

()

Source from the content-addressed store, hash-verified

158
159// fetchNextBatch fetches the next batch of keys from Redis matching the object type pattern.
160func (iter *EncodedObjectIter) fetchNextBatch() {
161 if iter.moreData {
162 pattern := withNamespace(iter.namespacePrefix, objectPrefix, fmt.Sprintf("%s:*", iter.t))
163 var err error
164 iter.keys, iter.cursor, err = iter.client.Scan(ctx, iter.cursor, pattern, 100).Result()
165 if err != nil {
166 iter.moreData = false // Stop further fetches on error
167 return
168 }
169 // Update moreData based on whether the cursor returned to 0
170 iter.moreData = (iter.cursor != 0)
171 }
172}
173
174// Next moves the iterator to the next object and returns it.
175func (iter *EncodedObjectIter) Next() (plumbing.EncodedObject, error) {

Callers 2

IterEncodedObjectsMethod · 0.95
NextMethod · 0.95

Calls 1

withNamespaceFunction · 0.85

Tested by

no test coverage detected