working commit

This commit is contained in:
2026-03-10 12:52:12 +02:00
parent d0a5fab362
commit d1ef1fbe50
42 changed files with 242 additions and 426 deletions
+12 -8
View File
@@ -18,26 +18,26 @@ const (
MediaTypeOIMv1 = "application/vnd.oci.image.manifest.v1+json"
)
type Downloader struct {
type Loader struct {
cli *Client
}
func NewDownloader(client *Client) *Downloader {
return &Downloader{
func NewLoader(client *Client) *Loader {
return &Loader{
cli: client,
}
}
func (down *Downloader) Pull(ctx context.Context, rawref, dir, osname, arch string) error {
func (down *Loader) Pull(ctx context.Context, rawref, dir, osname, arch string) error {
var err error
ref, err := ParseReference(rawref)
ref, err := NewReferer(rawref)
if err != nil {
return err
}
rawrepo := ref.Repo()
rawrepo := ref.RawRepo()
tag := ref.Tag()
exist, mime, man, err := down.cli.GetManifest(ctx, rawrepo, tag)
exist, mime, man, err := down.cli.GetRawManifest(ctx, ref.Raw())
if err != nil {
return err
}
@@ -64,8 +64,12 @@ func (down *Downloader) Pull(ctx context.Context, rawref, dir, osname, arch stri
}
}
}
if digstr == "" {
err = errors.New("Manifest for required arch and OS not found")
return err
}
fmt.Printf("Tag: %s\n", tag)
exist, mime, man, err = down.cli.GetManifest(ctx, rawrepo, tag)
exist, mime, man, err = down.cli.GetRawManifest(ctx, ref.RawWithTag(digstr))
if err != nil {
return err
}