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

Method buildPoolPath

files/package_pool.go:63–77  ·  view source on GitHub ↗

buildPoolPath generates pool path based on file checksum

(filename string, checksums *utils.ChecksumInfo)

Source from the content-addressed store, hash-verified

61
62// buildPoolPath generates pool path based on file checksum
63func (pool *PackagePool) buildPoolPath(filename string, checksums *utils.ChecksumInfo) (string, error) {
64 filename = filepath.Base(filename)
65 if filename == "." || filename == "/" {
66 return "", fmt.Errorf("filename %s is invalid", filename)
67 }
68
69 hash := checksums.SHA256
70
71 if len(hash) < 4 {
72 // this should never happen in real life
73 return "", fmt.Errorf("unable to compute pool location for filename %v, SHA256 is missing", filename)
74 }
75
76 return filepath.Join(hash[0:2], hash[2:4], hash[4:32]+"_"+filename), nil
77}
78
79// FilepathList returns file paths of all the files in the pool
80func (pool *PackagePool) FilepathList(progress aptly.Progress) ([]string, error) {

Callers 3

VerifyMethod · 0.95
ImportMethod · 0.95
isSameDeviceFunction · 0.45

Calls

no outgoing calls

Tested by 1

isSameDeviceFunction · 0.36