Watch
1
0
Fork
You've already forked pkg-proxy
1
mirror of https://github.com/git-pkgs/proxy.git synced 2026-11-09 15:49:16 -05:00
pkg-proxy/internal/database/cached_names.go
Simon Chrzanowski 3f83d9c0ce Mirror Julia packages
proxy mirror and mirror jobs now take pkg:julia PURLs with the uuid
qualifier. The tree hash of the version comes from the General registry,
after checking the uuid is the one General lists for the name, and the
tarball is fetched from upstream.julia at /package/{uuid}/{tree-hash} and
cached under the name and tree hash the Julia handler uses.

The handler names a package from the registry's Registry.toml, which it
loads from the upstream. Without the upstream it fell back to caching and
looking up by uuid, so a package cached under its name, mirrored or
fetched before a restart, was not served offline. It now looks the
tarball up by its tree hash in that case.

Julia versions are listed from General whatever upstream.julia is, as
packages are identified by uuid and tree hash on every Pkg server serving
General.
2026-10-25 19:37:46 +01:00

21 lines
785 B
Go

package database
// CachedArtifactNames returns the names of the packages of ecosystem that
// have a cached artifact called filename, for protocols whose file names
// identify an artifact without its package name.
func (db *DB) CachedArtifactNames(ecosystem, filename string) ([]string, error) {
var names []string
query := db.Rebind(`
SELECT DISTINCT packages.name
FROM artifacts
JOIN versions ON versions.purl = artifacts.version_purl
JOIN packages ON packages.purl = versions.package_purl
WHERE packages.ecosystem = ? AND artifacts.filename = ?
AND artifacts.storage_path IS NOT NULL AND artifacts.fetched_at IS NOT NULL
ORDER BY packages.name
`)
if err := db.Select(&names, query, ecosystem, filename); err != nil {
return nil, err
}
return names, nil
}