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

Method ForEach

pkg/cache/redis/object.go:203–221  ·  view source on GitHub ↗

ForEach iterates over all objects and applies a callback function to each.

(cb func(plumbing.EncodedObject) error)

Source from the content-addressed store, hash-verified

201
202// ForEach iterates over all objects and applies a callback function to each.
203func (iter *EncodedObjectIter) ForEach(cb func(plumbing.EncodedObject) error) error {
204 for {
205 obj, err := iter.Next()
206 if err != nil {
207 if err == io.EOF {
208 return nil
209 }
210 return err
211 }
212
213 err = cb(obj)
214 if err != nil {
215 if err == storer.ErrStop {
216 return nil
217 }
218 return err
219 }
220 }
221}
222
223// Close is a placeholder to satisfy the EncodedObjectIter interface.
224// Redis connections are managed outside the iterator, so there's nothing to close here.

Callers

nothing calls this directly

Calls 1

NextMethod · 0.95

Tested by

no test coverage detected