MCPcopy Index your code
hub / github.com/aptly-dev/aptly / ByUUID

Method ByUUID

deb/remote.go:982–1005  ·  view source on GitHub ↗

ByUUID looks up repository by uuid

(uuid string)

Source from the content-addressed store, hash-verified

980
981// ByUUID looks up repository by uuid
982func (collection *RemoteRepoCollection) ByUUID(uuid string) (*RemoteRepo, error) {
983 if r, ok := collection.cache[uuid]; ok {
984 return r, nil
985 }
986
987 key := (&RemoteRepo{UUID: uuid}).Key()
988
989 value, err := collection.db.Get(key)
990 if err == database.ErrNotFound {
991 return nil, fmt.Errorf("mirror with uuid %s not found", uuid)
992 }
993 if err != nil {
994 return nil, err
995 }
996
997 r := &RemoteRepo{}
998 err = r.Decode(value)
999
1000 if err == nil {
1001 collection.cache[r.UUID] = r
1002 }
1003
1004 return r, err
1005}
1006
1007// ForEach runs method for each repository
1008func (collection *RemoteRepoCollection) ForEach(handler func(*RemoteRepo) error) error {

Callers 1

TestByUUIDMethod · 0.95

Calls 3

DecodeMethod · 0.95
GetMethod · 0.65
KeyMethod · 0.45

Tested by 1

TestByUUIDMethod · 0.76