refactor(storage): refactoring storage (#1459)

Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
This commit is contained in:
LaurentiuNiculae
2023-05-26 21:08:19 +03:00
committed by GitHub
parent 9acd19f7ea
commit a3f355c278
45 changed files with 850 additions and 751 deletions
+10 -9
View File
@@ -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)