wip: oci image management
This commit is contained in:
27
controller/blob.go
Normal file
27
controller/blob.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user