splitted one operator module to file, account, image operators; splitted operator functions; etc

This commit is contained in:
2026-03-05 11:32:32 +02:00
parent 9ecd25ed0b
commit 80d6a244cf
54 changed files with 1049 additions and 826 deletions
+13 -15
View File
@@ -14,7 +14,7 @@ import (
"io"
"net/http"
"mstore/app/operator"
"mstore/app/imageoper"
"mstore/app/router"
"mstore/pkg/terms"
)
@@ -26,7 +26,7 @@ func (hand *Handler) BlobExists(rctx *router.Context) {
//hand.DumpHeaders("BlobExists", rctx)
params := &operator.BlobExistsParams{
params := &imageoper.BlobExistsParams{
Name: name,
Digest: digest,
}
@@ -43,7 +43,7 @@ func (hand *Handler) BlobExists(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
res, code, err := hand.oper.BlobExists(ctx, operatorID, params)
res, code, err := hand.imop.BlobExists(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("BlobExist error: %v", err)
}
@@ -75,7 +75,7 @@ func (hand *Handler) PostUpload(rctx *router.Context) {
mount := rctx.GetQuery("mount")
from := rctx.GetQuery("from")
params := &operator.PostUploadParams{
params := &imageoper.PostUploadParams{
Name: name,
Digest: digest,
Mount: mount,
@@ -93,7 +93,7 @@ func (hand *Handler) PostUpload(rctx *router.Context) {
return
}
// Execution of the operation
res, code, err := hand.oper.PostUpload(rctx.Ctx, operatorID, params)
res, code, err := hand.imop.PostUpload(rctx.Ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("PostUpload error: %v", err)
} else {
@@ -104,8 +104,6 @@ func (hand *Handler) PostUpload(rctx *router.Context) {
rctx.SetStatus(code)
}
// PATCH /v2/<name>/blobs/uploads/<reference> 202 404/416
func (hand *Handler) PatchUpload(rctx *router.Context) {
@@ -117,7 +115,7 @@ func (hand *Handler) PatchUpload(rctx *router.Context) {
reference, _ := rctx.GetSubpath("reference")
reader := rctx.Request.Body
params := &operator.PatchUploadParams{
params := &imageoper.PatchUploadParams{
ContentLength: contentLength,
ContentType: contentType,
ContentRange: contentRange,
@@ -138,7 +136,7 @@ func (hand *Handler) PatchUpload(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
res, code, err := hand.oper.PatchUpload(ctx, operatorID, params)
res, code, err := hand.imop.PatchUpload(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("PatchUpload error: %v", err)
}
@@ -162,7 +160,7 @@ func (hand *Handler) PutUpload(rctx *router.Context) {
digest := rctx.GetQuery("digest")
reader := rctx.Request.Body
params := &operator.PutUploadParams{
params := &imageoper.PutUploadParams{
ContentLength: contentLength,
ContentType: contentType,
ContentRange: contentRange,
@@ -183,7 +181,7 @@ func (hand *Handler) PutUpload(rctx *router.Context) {
return
}
// Execution of the operation
res, code, err := hand.oper.PutUpload(rctx.Ctx, operatorID, params)
res, code, err := hand.imop.PutUpload(rctx.Ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("PutUpload error: %v", err)
}
@@ -197,7 +195,7 @@ func (hand *Handler) GetBlob(rctx *router.Context) {
name, _ := rctx.GetSubpath("name")
digest, _ := rctx.GetSubpath("digest")
params := &operator.GetBlobParams{
params := &imageoper.GetBlobParams{
Name: name,
Digest: digest,
}
@@ -214,7 +212,7 @@ func (hand *Handler) GetBlob(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
res, code, err := hand.oper.GetBlob(ctx, operatorID, params)
res, code, err := hand.imop.GetBlob(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("GetBlob error: %v", err)
}
@@ -243,7 +241,7 @@ func (hand *Handler) DeleteBlob(rctx *router.Context) {
name, _ := rctx.GetSubpath("name")
digest, _ := rctx.GetSubpath("digest")
params := &operator.DeleteBlobParams{
params := &imageoper.DeleteBlobParams{
Name: name,
Digest: digest,
}
@@ -260,7 +258,7 @@ func (hand *Handler) DeleteBlob(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
_, code, err := hand.oper.DeleteBlob(ctx, operatorID, params)
_, code, err := hand.imop.DeleteBlob(ctx, operatorID, params)
if err != nil {
hand.logg.Errorf("DeleteBlob error: %v", err)
}