feat(offsite): 异地副本加入 registry 用户镜像,按摘要加密去重,索引按版本保留 14 天,新增 fetch-images 回推恢复

This commit is contained in:
Lemon-miaow committed 2026-09-25 04:33:23 +08:00
1 parent 0e93e961ed
commit e3ac9cd545
13 files changed
+1626 -51

No files matched your search

+20
View File
@@ -493,3 +493,23 @@ func (w *prefixWriter) Write(p []byte) (int, error) {
}
return len(p), nil
}
// UploadBlob uploads the blob open returns into host/repo unless the repository
// already holds digest, retrying like Push. open is called once per attempt.
func (p *Pusher) UploadBlob(ctx context.Context, host, repo, digest string, size int64, open func() (io.ReadCloser, error)) error {
r := Ref{Host: host, Repo: repo}
return p.retry(ctx, func() error { return p.uploadBlob(ctx, r, digest, size, open) })
}
// PutManifest stores body in host/repo under reference, a tag or the digest body
// hashes to, retrying like Push, and returns that digest.
func (p *Pusher) PutManifest(ctx context.Context, host, repo, reference, mediaType string, body []byte) (string, error) {
r := Ref{Host: host, Repo: repo, Tag: reference}
var digest string
err := p.retry(ctx, func() error {
d, err := p.putManifest(ctx, r, mediaType, body)
digest = d
return err
})
return digest, err
}