MCPcopy Create free account
hub / github.com/aptly-dev/aptly / SearchByKey

Method SearchByKey

deb/package_collection.go:330–345  ·  view source on GitHub ↗

SearchByKey finds package by exact key

(arch, name, version string)

Source from the content-addressed store, hash-verified

328
329// SearchByKey finds package by exact key
330func (collection *PackageCollection) SearchByKey(arch, name, version string) (result *PackageList) {
331 result = NewPackageListWithDuplicates(true, 0)
332
333 for _, key := range collection.db.KeysByPrefix([]byte(fmt.Sprintf("P%s %s %s", arch, name, version))) {
334 pkg, err := collection.ByKey(key)
335 if err != nil {
336 panic(fmt.Sprintf("unable to load package: %s", err))
337 }
338
339 if pkg.Architecture == arch && pkg.Name == name && pkg.Version == version {
340 _ = result.Add(pkg)
341 }
342 }
343
344 return
345}

Callers

nothing calls this directly

Calls 4

ByKeyMethod · 0.95
KeysByPrefixMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected