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

Method HasEncodedObject

pkg/cache/redis/object.go:117–135  ·  view source on GitHub ↗
(h plumbing.Hash)

Source from the content-addressed store, hash-verified

115}
116
117func (s *Storage) HasEncodedObject(h plumbing.Hash) error {
118 pattern := withNamespace(s.namespacePrefix, objectPrefix, fmt.Sprintf("*:%s", h.String()))
119 var cursor uint64
120 var err error
121 for {
122 var keys []string
123 keys, cursor, err = s.client.Scan(ctx, cursor, pattern, 1).Result()
124 if err != nil {
125 return err
126 }
127 if len(keys) > 0 {
128 return nil // Key exists
129 }
130 if cursor == 0 { // No more keys to scan
131 break
132 }
133 }
134 return plumbing.ErrObjectNotFound
135}
136
137type EncodedObjectIter struct {
138 client *redis.Client

Callers

nothing calls this directly

Calls 2

withNamespaceFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected