working commit
This commit is contained in:
+1
-7
@@ -21,7 +21,6 @@ func (hand *Handler) BlobExists(rctx *router.Context) {
|
||||
name, _ := rctx.GetSubpath("name")
|
||||
digest, _ := rctx.GetSubpath("digest")
|
||||
|
||||
hand.logg.Debugf("Handle BlobExists with name=[%s] digest=[%s]", name, digest)
|
||||
params := &operator.BlobExistsParams{
|
||||
Name: name,
|
||||
Digest: digest,
|
||||
@@ -40,11 +39,11 @@ func (hand *Handler) BlobExists(rctx *router.Context) {
|
||||
// POST /v2/<name>/blobs/uploads/ 202 404
|
||||
func (hand *Handler) PostUpload(rctx *router.Context) {
|
||||
name, _ := rctx.GetSubpath("name")
|
||||
|
||||
digest := rctx.GetQuery("digest")
|
||||
mount := rctx.GetQuery("mount")
|
||||
from := rctx.GetQuery("from")
|
||||
|
||||
hand.logg.Debugf("Handle PostUpload with name=[%s] digest=[%s]", name, digest)
|
||||
params := &operator.PostUploadParams{
|
||||
Name: name,
|
||||
Digest: digest,
|
||||
@@ -55,7 +54,6 @@ func (hand *Handler) PostUpload(rctx *router.Context) {
|
||||
if err != nil {
|
||||
hand.logg.Errorf("PostUpload error: %v", err)
|
||||
} else {
|
||||
hand.logg.Debugf("PostUpload send location=[%s] code=%d", res.Location, code)
|
||||
rctx.SetHeader("Location", res.Location)
|
||||
rctx.SetHeader("Content-Length", res.ContentLength)
|
||||
rctx.SetHeader("Docker-Upload-UUID", res.DockerUploadUUID)
|
||||
@@ -69,8 +67,6 @@ func (hand *Handler) PostUpload(rctx *router.Context) {
|
||||
// PATCH /v2/<name>/blobs/uploads/<reference> 202 404/416
|
||||
func (hand *Handler) PatchUpload(rctx *router.Context) {
|
||||
|
||||
//hand.DumpHeaders("PatchUpload headers", rctx)
|
||||
|
||||
contentLength := rctx.GetHeader("Content-Length")
|
||||
contentType := rctx.GetHeader("Content-Type")
|
||||
contentRange := rctx.GetHeader("Content-Range")
|
||||
@@ -102,8 +98,6 @@ func (hand *Handler) PatchUpload(rctx *router.Context) {
|
||||
// PUT /v2/<name>/uploads/<reference>?digest=<digest> 202 404/416
|
||||
func (hand *Handler) PutUpload(rctx *router.Context) {
|
||||
|
||||
//hand.DumpHeaders("PutUpload headers", rctx)
|
||||
|
||||
contentType := rctx.GetHeader("Content-Type")
|
||||
contentLength := rctx.GetHeader("Content-Length")
|
||||
contentRange := rctx.GetHeader("Content-Range")
|
||||
|
||||
+5
-15
@@ -10,9 +10,8 @@ import (
|
||||
const zeroContentLength = "0"
|
||||
|
||||
func (hand *Handler) FileExists(rctx *router.Context) {
|
||||
hand.logg.Debugf("Handle FileExists")
|
||||
|
||||
filepath := rctx.PathMap["filepath"]
|
||||
filepath := rctx.GetSubpath("filepath")
|
||||
params := &operator.FileExistsParams{
|
||||
Filepath: filepath,
|
||||
}
|
||||
@@ -32,13 +31,9 @@ func (hand *Handler) FileExists(rctx *router.Context) {
|
||||
}
|
||||
|
||||
func (hand *Handler) PutFile(rctx *router.Context) {
|
||||
hand.logg.Debugf("Handle PutFile")
|
||||
|
||||
contentLength := rctx.GetHeader("Content-Length")
|
||||
contentType := rctx.GetHeader("Content-Type")
|
||||
filepath := rctx.PathMap["filepath"]
|
||||
|
||||
hand.logg.Debugf("Content-Length=%s", rctx.GetHeader("Content-Length"))
|
||||
filepath := rctx.GetSubpath("filepath")
|
||||
|
||||
params := &operator.PutFileParams{
|
||||
Filepath: filepath,
|
||||
@@ -58,14 +53,11 @@ func (hand *Handler) PutFile(rctx *router.Context) {
|
||||
}
|
||||
|
||||
func (hand *Handler) GetFile(rctx *router.Context) {
|
||||
hand.logg.Debugf("Handle GetFile")
|
||||
|
||||
filepath := rctx.PathMap["filepath"]
|
||||
filepath := rctx.GetSubpath("filepath")
|
||||
params := &operator.GetFileParams{
|
||||
Filepath: filepath,
|
||||
}
|
||||
hand.logg.Debugf("filepath: %s", filepath)
|
||||
|
||||
ctx := rctx.GetContext()
|
||||
code, res, err := hand.oper.GetFile(ctx, params)
|
||||
if err != nil {
|
||||
@@ -90,9 +82,8 @@ func (hand *Handler) GetFile(rctx *router.Context) {
|
||||
}
|
||||
|
||||
func (hand *Handler) DeleteFile(rctx *router.Context) {
|
||||
hand.logg.Debugf("Handle DeleteFile")
|
||||
|
||||
filepath := rctx.PathMap["filepath"]
|
||||
filepath := rctx.GetSubpath("filepath")
|
||||
params := &operator.DeleteFileParams{
|
||||
Filepath: filepath,
|
||||
}
|
||||
@@ -106,9 +97,8 @@ func (hand *Handler) DeleteFile(rctx *router.Context) {
|
||||
}
|
||||
|
||||
func (hand *Handler) ListFiles(rctx *router.Context) {
|
||||
hand.logg.Debugf("Handle ListFiles")
|
||||
|
||||
filepath := rctx.PathMap["filepath"]
|
||||
filepath := rctx.GetSubpath("filepath")
|
||||
params := &operator.ListFilesParams{
|
||||
Filepath: filepath,
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
func (hand *Handler) ManifestExists(rctx *router.Context) {
|
||||
name, _ := rctx.GetSubpath("name")
|
||||
reference, _ := rctx.GetSubpath("reference")
|
||||
|
||||
params := &operator.ManifestExistsParams{
|
||||
Name: name,
|
||||
Reference: reference,
|
||||
|
||||
@@ -7,6 +7,6 @@ import (
|
||||
)
|
||||
|
||||
func (hand *Handler) NotFound(rctx *router.Context) {
|
||||
hand.logg.Debugf("Route for [%s %s] not found", rctx.Request.Method, rctx.Request.URL.String())
|
||||
hand.logg.Warningf("Route for [%s %s] not found", rctx.Request.Method, rctx.Request.URL.String())
|
||||
rctx.SetStatus(http.StatusNotFound)
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ import (
|
||||
)
|
||||
|
||||
func (hand *Handler) SendHello(rctx *router.Context) {
|
||||
hand.logg.Debugf("Handle SendHello")
|
||||
|
||||
params := &operator.SendHelloParams{}
|
||||
res, _ := hand.oper.SendHello(params)
|
||||
rctx.SetStatus(http.StatusOK)
|
||||
|
||||
+11
-6
@@ -23,7 +23,7 @@ type BlobExistsResult struct {
|
||||
func (oper *Operator) BlobExists(ctx context.Context, params *BlobExistsParams) (*BlobExistsResult, int, error) {
|
||||
var err error
|
||||
res := &BlobExistsResult{}
|
||||
oper.logg.Debugf("Call BlobExists")
|
||||
//oper.logg.Debugf("Calling BlobExists")
|
||||
|
||||
if params.Digest == "" {
|
||||
err = fmt.Errorf("Empty reference")
|
||||
@@ -79,7 +79,8 @@ type PostUploadResult struct {
|
||||
func (oper *Operator) PostUpload(ctx context.Context, params *PostUploadParams) (*PostUploadResult, int, error) {
|
||||
var err error
|
||||
res := &PostUploadResult{}
|
||||
oper.logg.Debugf("PostUpload")
|
||||
|
||||
//oper.logg.Debugf("Calling PostUpload")
|
||||
|
||||
if params.Digest == "" {
|
||||
uuid := auxuuid.NewUUID()
|
||||
@@ -116,7 +117,8 @@ type PatchUploadResult struct {
|
||||
func (oper *Operator) PatchUpload(ctx context.Context, params *PatchUploadParams) (*PatchUploadResult, int, error) {
|
||||
var err error
|
||||
res := &PatchUploadResult{}
|
||||
oper.logg.Debugf("Call PatchUpload")
|
||||
|
||||
//oper.logg.Debugf("Calling PatchUpload")
|
||||
|
||||
if params.Reference == "" {
|
||||
err = fmt.Errorf("Empty reference")
|
||||
@@ -182,7 +184,8 @@ type PutUploadResult struct {
|
||||
func (oper *Operator) PutUpload(ctx context.Context, params *PutUploadParams) (*PutUploadResult, int, error) {
|
||||
var err error
|
||||
res := &PutUploadResult{}
|
||||
oper.logg.Debugf("Call PutUpload")
|
||||
|
||||
//oper.logg.Debugf("Calling PutUpload")
|
||||
|
||||
if params.Reference == "" {
|
||||
err = fmt.Errorf("Empty reference")
|
||||
@@ -240,7 +243,8 @@ type GetBlobResult struct {
|
||||
func (oper *Operator) GetBlob(ctx context.Context, params *GetBlobParams) (*GetBlobResult, int, error) {
|
||||
var err error
|
||||
res := &GetBlobResult{}
|
||||
oper.logg.Debugf("Calling GetBlob %s:%s", params.Name, params.Digest)
|
||||
|
||||
//oper.logg.Debugf("Calling GetBlob %s:%s", params.Name, params.Digest)
|
||||
|
||||
if params.Name == "" {
|
||||
err = fmt.Errorf("Empty name")
|
||||
@@ -280,7 +284,8 @@ type DeleteBlobResult struct{}
|
||||
func (oper *Operator) DeleteBlob(ctx context.Context, params *DeleteBlobParams) (*DeleteBlobResult, int, error) {
|
||||
var err error
|
||||
res := &DeleteBlobResult{}
|
||||
oper.logg.Debugf("DeleteBlob")
|
||||
|
||||
//oper.logg.Debugf("Calling DeleteBlob")
|
||||
|
||||
if params.Digest == "" {
|
||||
err = fmt.Errorf("Empty digest")
|
||||
|
||||
@@ -92,7 +92,8 @@ type PutManifestResult struct {
|
||||
func (oper *Operator) PutManifest(ctx context.Context, params *PutManifestParams) (*PutManifestResult, int, error) {
|
||||
var err error
|
||||
res := &PutManifestResult{}
|
||||
oper.logg.Debugf("Put manifest %s:%s", params.Name, params.Reference)
|
||||
|
||||
//oper.logg.Debugf("Put manifest %s:%s", params.Name, params.Reference)
|
||||
|
||||
if params.Reference == "" {
|
||||
err = fmt.Errorf("Empty reference")
|
||||
@@ -240,7 +241,17 @@ type GetManifestResult struct {
|
||||
func (oper *Operator) GetManifest(ctx context.Context, params *GetManifestParams) (*GetManifestResult, int, error) {
|
||||
var err error
|
||||
res := &GetManifestResult{}
|
||||
oper.logg.Debugf("Get manifest %s:%s", params.Name, params.Reference)
|
||||
|
||||
//oper.logg.Debugf("Get manifest %s:%s", params.Name, params.Reference)
|
||||
|
||||
if params.Name == "" {
|
||||
err = fmt.Errorf("Empty name")
|
||||
return res, http.StatusBadRequest, err
|
||||
}
|
||||
if params.Reference == "" {
|
||||
err = fmt.Errorf("Empty reference")
|
||||
return res, http.StatusBadRequest, err
|
||||
}
|
||||
|
||||
manifestDescr := descr.Manifest{}
|
||||
var exists bool
|
||||
|
||||
Reference in New Issue
Block a user