Files
cluster/controller/blob.go
2025-11-09 15:19:11 +08:00

28 lines
604 B
Go

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
}