mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 12:58:02 +08:00
refactor(storage): refactoring storage (#1459)
Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
This commit is contained in:
@@ -3,17 +3,18 @@ package storage
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
storageTypes "zotregistry.io/zot/pkg/storage/types"
|
||||
)
|
||||
|
||||
const (
|
||||
CosignType = "cosign"
|
||||
NotationType = "notation"
|
||||
)
|
||||
|
||||
type StoreController struct {
|
||||
DefaultStore ImageStore
|
||||
SubStore map[string]ImageStore
|
||||
}
|
||||
|
||||
// BlobUpload models and upload request.
|
||||
type BlobUpload struct {
|
||||
StoreName string
|
||||
ID string
|
||||
DefaultStore storageTypes.ImageStore
|
||||
SubStore map[string]storageTypes.ImageStore
|
||||
}
|
||||
|
||||
func GetRoutePrefix(name string) string {
|
||||
@@ -29,7 +30,7 @@ func GetRoutePrefix(name string) string {
|
||||
return fmt.Sprintf("/%s", names[0])
|
||||
}
|
||||
|
||||
func (sc StoreController) GetImageStore(name string) ImageStore {
|
||||
func (sc StoreController) GetImageStore(name string) storageTypes.ImageStore {
|
||||
if sc.SubStore != nil {
|
||||
// SubStore is being provided, now we need to find equivalent image store and this will be found by splitting name
|
||||
prefixName := GetRoutePrefix(name)
|
||||
|
||||
Reference in New Issue
Block a user