wip: oci image management

This commit is contained in:
loveuer
2025-11-09 15:19:11 +08:00
commit 8de8234372
58 changed files with 6142 additions and 0 deletions

27
controller/blob.go Normal file
View File

@@ -0,0 +1,27 @@
package controller
import (
"io"
"gitea.loveuer.com/loveuer/cluster/internal/registry/storage"
)
// GetBlob 获取 blob
func GetBlob(store storage.Storage, repo, digest string) (io.ReadCloser, int64, error) {
return store.GetBlob(repo, digest)
}
// HeadBlob 检查 blob 是否存在并返回大小
func HeadBlob(store storage.Storage, repo, digest string) (bool, int64, error) {
exists, err := store.BlobExists(repo, digest)
if err != nil || !exists {
return false, 0, err
}
size, err := store.GetBlobSize(repo, digest)
if err != nil {
return false, 0, err
}
return true, size, nil
}