fetchNextBatch fetches the next batch of keys from Redis matching the object type pattern.
()
| 158 | |
| 159 | // fetchNextBatch fetches the next batch of keys from Redis matching the object type pattern. |
| 160 | func (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. |
| 175 | func (iter *EncodedObjectIter) Next() (plumbing.EncodedObject, error) { |
no test coverage detected