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

Method SetShallow

pkg/cache/redis/shallow.go:18–30  ·  view source on GitHub ↗

SetShallow stores a list of shallow commit hashes in Redis.

(commits []plumbing.Hash)

Source from the content-addressed store, hash-verified

16
17// SetShallow stores a list of shallow commit hashes in Redis.
18func (s *ShallowStorage) SetShallow(commits []plumbing.Hash) error {
19 key := withNamespace(s.namespacePrefix, shallowPrefix, "")
20
21 // Convert plumbing.Hash slices to string slices for Redis.
22 var hashes []string
23 for _, hash := range commits {
24 hashes = append(hashes, hash.String())
25 }
26
27 // Use SAdd for adding items to a set. This operation is idempotent.
28 _, err := s.client.SAdd(ctx, key, hashes).Result()
29 return err
30}
31
32// Shallow retrieves the list of shallow commit hashes from Redis.
33func (s *ShallowStorage) Shallow() ([]plumbing.Hash, error) {

Callers

nothing calls this directly

Calls 2

withNamespaceFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected