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
+15 -15
View File
@@ -12,7 +12,7 @@ package handler
import (
"net/http"
"mstore/app/operator"
"mstore/app/imageoper"
"mstore/app/router"
"mstore/pkg/terms"
)
@@ -23,7 +23,7 @@ func (hand *Handler) ManifestExists(rctx *router.Context) {
//hand.DumpHeaders("ManigestExists:\n", rctx)
params := &operator.ManifestExistsParams{
params := &imageoper.ManifestExistsParams{
Name: name,
Reference: reference,
}
@@ -40,7 +40,7 @@ func (hand *Handler) ManifestExists(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
res, code, err := hand.oper.ManifestExists(ctx, params)
res, code, err := hand.imop.ManifestExists(ctx, params)
if err != nil {
hand.logg.Errorf("ManifestExist error: %v", err)
} else if code == http.StatusOK {
@@ -62,7 +62,7 @@ func (hand *Handler) PutManifest(rctx *router.Context) {
name, _ := rctx.GetSubpath("name")
reference, _ := rctx.GetSubpath("reference")
params := &operator.PutManifestParams{
params := &imageoper.PutManifestParams{
ContentType: contentType,
ContentLength: contentLength,
Name: name,
@@ -82,7 +82,7 @@ func (hand *Handler) PutManifest(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
res, code, err := hand.oper.PutManifest(ctx, params)
res, code, err := hand.imop.PutManifest(ctx, params)
if err != nil {
hand.logg.Errorf("PutManifest error: %v", err)
} else {
@@ -98,7 +98,7 @@ func (hand *Handler) GetManifest(rctx *router.Context) {
//hand.DumpHeaders("GetManigest", rctx)
params := &operator.GetManifestParams{
params := &imageoper.GetManifestParams{
Name: name,
Reference: reference,
}
@@ -115,7 +115,7 @@ func (hand *Handler) GetManifest(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
res, code, err := hand.oper.GetManifest(ctx, params)
res, code, err := hand.imop.GetManifest(ctx, params)
if err != nil {
hand.logg.Errorf("GetManifest error: %v", err)
rctx.SetStatus(code)
@@ -138,7 +138,7 @@ func (hand *Handler) DeleteManifest(rctx *router.Context) {
name, _ := rctx.GetSubpath("name")
reference, _ := rctx.GetSubpath("reference")
params := &operator.DeleteManifestParams{
params := &imageoper.DeleteManifestParams{
Name: name,
Reference: reference,
}
@@ -155,7 +155,7 @@ func (hand *Handler) DeleteManifest(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
_, code, err := hand.oper.DeleteManifest(ctx, params)
_, code, err := hand.imop.DeleteManifest(ctx, params)
if err != nil {
hand.logg.Errorf("DeleteManifest error: %v", err)
}
@@ -167,7 +167,7 @@ func (hand *Handler) DeleteManifest(rctx *router.Context) {
func (hand *Handler) GetReferer(rctx *router.Context) {
name, _ := rctx.GetSubpath("name")
digest, _ := rctx.GetSubpath("digest")
params := &operator.GetRefererParams{
params := &imageoper.GetRefererParams{
Name: name,
Digest: digest,
}
@@ -183,7 +183,7 @@ func (hand *Handler) GetReferer(rctx *router.Context) {
return
}
// Execution of the operation
res, code, err := hand.oper.GetReferer(rctx.Ctx, params)
res, code, err := hand.imop.GetReferer(rctx.Ctx, params)
if err != nil {
hand.logg.Errorf("GetReferer error: %v", err)
}
@@ -194,7 +194,7 @@ func (hand *Handler) GetReferer(rctx *router.Context) {
// GET /v2/<name>/tags/list?n=<integer>&last=<integer>
func (hand *Handler) GetTags(rctx *router.Context) {
name, _ := rctx.GetSubpath("name")
params := &operator.GetTagsParams{
params := &imageoper.GetTagsParams{
Name: name,
}
// Rigth checking
@@ -210,7 +210,7 @@ func (hand *Handler) GetTags(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
res, code, err := hand.oper.GetTags(ctx, params)
res, code, err := hand.imop.GetTags(ctx, params)
if err != nil {
hand.logg.Errorf("GetTags error: %v", err)
}
@@ -219,7 +219,7 @@ func (hand *Handler) GetTags(rctx *router.Context) {
// GET /v2/_catalog?n=1000 200 404
func (hand *Handler) ListManifests(rctx *router.Context) {
params := &operator.ListManifestsParams{}
params := &imageoper.ListManifestsParams{}
// Rigth checking
operatorID, _ := rctx.GetString(userTag)
opEnable, err := hand.CheckRight(rctx.Ctx, operatorID, terms.RightReadImages, "_catalog")
@@ -233,7 +233,7 @@ func (hand *Handler) ListManifests(rctx *router.Context) {
}
// Execution of the operation
ctx := rctx.GetContext()
res, code, err := hand.oper.ListManifests(ctx, params)
res, code, err := hand.imop.ListManifests(ctx, params)
if err != nil {
hand.logg.Errorf("ListManifests error: %v", err)
}