working commit
This commit is contained in:
+2
-1
@@ -3,7 +3,6 @@ autom4te.cache
|
|||||||
Makefile
|
Makefile
|
||||||
config.status
|
config.status
|
||||||
config.log
|
config.log
|
||||||
mstored
|
|
||||||
cmd/mstored/mstored
|
cmd/mstored/mstored
|
||||||
cmd/mstorectl/mstorectl
|
cmd/mstorectl/mstorectl
|
||||||
*.db
|
*.db
|
||||||
@@ -14,3 +13,5 @@ cmd/mstorectl/mstorectl
|
|||||||
*.tar
|
*.tar
|
||||||
*.bin
|
*.bin
|
||||||
tmp
|
tmp
|
||||||
|
mstored
|
||||||
|
mstorectl
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ format:
|
|||||||
(echo "====$$dir===="; cd $$dir && $(GO) fmt .); \
|
(echo "====$$dir===="; cd $$dir && $(GO) fmt .); \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
|
||||||
|
test:
|
||||||
|
cd pkg/client && $(GO) test -v .
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
$(FIND) $(CWD) -name '*~' | $(XARGS) rm -f
|
$(FIND) $(CWD) -name '*~' | $(XARGS) rm -f
|
||||||
rm -rf autom4te.cache
|
rm -rf autom4te.cache
|
||||||
|
|||||||
@@ -800,6 +800,11 @@ format:
|
|||||||
(echo "====$$dir===="; cd $$dir && $(GO) fmt .); \
|
(echo "====$$dir===="; cd $$dir && $(GO) fmt .); \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
|
||||||
|
test:
|
||||||
|
cd pkg/client && $(GO) test -v .
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
$(FIND) $(CWD) -name '*~' | $(XARGS) rm -f
|
$(FIND) $(CWD) -name '*~' | $(XARGS) rm -f
|
||||||
rm -rf autom4te.cache
|
rm -rf autom4te.cache
|
||||||
|
|||||||
+1
-7
@@ -21,7 +21,6 @@ func (hand *Handler) BlobExists(rctx *router.Context) {
|
|||||||
name, _ := rctx.GetSubpath("name")
|
name, _ := rctx.GetSubpath("name")
|
||||||
digest, _ := rctx.GetSubpath("digest")
|
digest, _ := rctx.GetSubpath("digest")
|
||||||
|
|
||||||
hand.logg.Debugf("Handle BlobExists with name=[%s] digest=[%s]", name, digest)
|
|
||||||
params := &operator.BlobExistsParams{
|
params := &operator.BlobExistsParams{
|
||||||
Name: name,
|
Name: name,
|
||||||
Digest: digest,
|
Digest: digest,
|
||||||
@@ -40,11 +39,11 @@ func (hand *Handler) BlobExists(rctx *router.Context) {
|
|||||||
// POST /v2/<name>/blobs/uploads/ 202 404
|
// POST /v2/<name>/blobs/uploads/ 202 404
|
||||||
func (hand *Handler) PostUpload(rctx *router.Context) {
|
func (hand *Handler) PostUpload(rctx *router.Context) {
|
||||||
name, _ := rctx.GetSubpath("name")
|
name, _ := rctx.GetSubpath("name")
|
||||||
|
|
||||||
digest := rctx.GetQuery("digest")
|
digest := rctx.GetQuery("digest")
|
||||||
mount := rctx.GetQuery("mount")
|
mount := rctx.GetQuery("mount")
|
||||||
from := rctx.GetQuery("from")
|
from := rctx.GetQuery("from")
|
||||||
|
|
||||||
hand.logg.Debugf("Handle PostUpload with name=[%s] digest=[%s]", name, digest)
|
|
||||||
params := &operator.PostUploadParams{
|
params := &operator.PostUploadParams{
|
||||||
Name: name,
|
Name: name,
|
||||||
Digest: digest,
|
Digest: digest,
|
||||||
@@ -55,7 +54,6 @@ func (hand *Handler) PostUpload(rctx *router.Context) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
hand.logg.Errorf("PostUpload error: %v", err)
|
hand.logg.Errorf("PostUpload error: %v", err)
|
||||||
} else {
|
} else {
|
||||||
hand.logg.Debugf("PostUpload send location=[%s] code=%d", res.Location, code)
|
|
||||||
rctx.SetHeader("Location", res.Location)
|
rctx.SetHeader("Location", res.Location)
|
||||||
rctx.SetHeader("Content-Length", res.ContentLength)
|
rctx.SetHeader("Content-Length", res.ContentLength)
|
||||||
rctx.SetHeader("Docker-Upload-UUID", res.DockerUploadUUID)
|
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
|
// PATCH /v2/<name>/blobs/uploads/<reference> 202 404/416
|
||||||
func (hand *Handler) PatchUpload(rctx *router.Context) {
|
func (hand *Handler) PatchUpload(rctx *router.Context) {
|
||||||
|
|
||||||
//hand.DumpHeaders("PatchUpload headers", rctx)
|
|
||||||
|
|
||||||
contentLength := rctx.GetHeader("Content-Length")
|
contentLength := rctx.GetHeader("Content-Length")
|
||||||
contentType := rctx.GetHeader("Content-Type")
|
contentType := rctx.GetHeader("Content-Type")
|
||||||
contentRange := rctx.GetHeader("Content-Range")
|
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
|
// PUT /v2/<name>/uploads/<reference>?digest=<digest> 202 404/416
|
||||||
func (hand *Handler) PutUpload(rctx *router.Context) {
|
func (hand *Handler) PutUpload(rctx *router.Context) {
|
||||||
|
|
||||||
//hand.DumpHeaders("PutUpload headers", rctx)
|
|
||||||
|
|
||||||
contentType := rctx.GetHeader("Content-Type")
|
contentType := rctx.GetHeader("Content-Type")
|
||||||
contentLength := rctx.GetHeader("Content-Length")
|
contentLength := rctx.GetHeader("Content-Length")
|
||||||
contentRange := rctx.GetHeader("Content-Range")
|
contentRange := rctx.GetHeader("Content-Range")
|
||||||
|
|||||||
+5
-15
@@ -10,9 +10,8 @@ import (
|
|||||||
const zeroContentLength = "0"
|
const zeroContentLength = "0"
|
||||||
|
|
||||||
func (hand *Handler) FileExists(rctx *router.Context) {
|
func (hand *Handler) FileExists(rctx *router.Context) {
|
||||||
hand.logg.Debugf("Handle FileExists")
|
|
||||||
|
|
||||||
filepath := rctx.PathMap["filepath"]
|
filepath := rctx.GetSubpath("filepath")
|
||||||
params := &operator.FileExistsParams{
|
params := &operator.FileExistsParams{
|
||||||
Filepath: filepath,
|
Filepath: filepath,
|
||||||
}
|
}
|
||||||
@@ -32,13 +31,9 @@ func (hand *Handler) FileExists(rctx *router.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (hand *Handler) PutFile(rctx *router.Context) {
|
func (hand *Handler) PutFile(rctx *router.Context) {
|
||||||
hand.logg.Debugf("Handle PutFile")
|
|
||||||
|
|
||||||
contentLength := rctx.GetHeader("Content-Length")
|
contentLength := rctx.GetHeader("Content-Length")
|
||||||
contentType := rctx.GetHeader("Content-Type")
|
contentType := rctx.GetHeader("Content-Type")
|
||||||
filepath := rctx.PathMap["filepath"]
|
filepath := rctx.GetSubpath("filepath")
|
||||||
|
|
||||||
hand.logg.Debugf("Content-Length=%s", rctx.GetHeader("Content-Length"))
|
|
||||||
|
|
||||||
params := &operator.PutFileParams{
|
params := &operator.PutFileParams{
|
||||||
Filepath: filepath,
|
Filepath: filepath,
|
||||||
@@ -58,14 +53,11 @@ func (hand *Handler) PutFile(rctx *router.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (hand *Handler) GetFile(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{
|
params := &operator.GetFileParams{
|
||||||
Filepath: filepath,
|
Filepath: filepath,
|
||||||
}
|
}
|
||||||
hand.logg.Debugf("filepath: %s", filepath)
|
|
||||||
|
|
||||||
ctx := rctx.GetContext()
|
ctx := rctx.GetContext()
|
||||||
code, res, err := hand.oper.GetFile(ctx, params)
|
code, res, err := hand.oper.GetFile(ctx, params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -90,9 +82,8 @@ func (hand *Handler) GetFile(rctx *router.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (hand *Handler) DeleteFile(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{
|
params := &operator.DeleteFileParams{
|
||||||
Filepath: filepath,
|
Filepath: filepath,
|
||||||
}
|
}
|
||||||
@@ -106,9 +97,8 @@ func (hand *Handler) DeleteFile(rctx *router.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (hand *Handler) ListFiles(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{
|
params := &operator.ListFilesParams{
|
||||||
Filepath: filepath,
|
Filepath: filepath,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
func (hand *Handler) ManifestExists(rctx *router.Context) {
|
func (hand *Handler) ManifestExists(rctx *router.Context) {
|
||||||
name, _ := rctx.GetSubpath("name")
|
name, _ := rctx.GetSubpath("name")
|
||||||
reference, _ := rctx.GetSubpath("reference")
|
reference, _ := rctx.GetSubpath("reference")
|
||||||
|
|
||||||
params := &operator.ManifestExistsParams{
|
params := &operator.ManifestExistsParams{
|
||||||
Name: name,
|
Name: name,
|
||||||
Reference: reference,
|
Reference: reference,
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (hand *Handler) NotFound(rctx *router.Context) {
|
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)
|
rctx.SetStatus(http.StatusNotFound)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (hand *Handler) SendHello(rctx *router.Context) {
|
func (hand *Handler) SendHello(rctx *router.Context) {
|
||||||
hand.logg.Debugf("Handle SendHello")
|
|
||||||
|
|
||||||
params := &operator.SendHelloParams{}
|
params := &operator.SendHelloParams{}
|
||||||
res, _ := hand.oper.SendHello(params)
|
res, _ := hand.oper.SendHello(params)
|
||||||
rctx.SetStatus(http.StatusOK)
|
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) {
|
func (oper *Operator) BlobExists(ctx context.Context, params *BlobExistsParams) (*BlobExistsResult, int, error) {
|
||||||
var err error
|
var err error
|
||||||
res := &BlobExistsResult{}
|
res := &BlobExistsResult{}
|
||||||
oper.logg.Debugf("Call BlobExists")
|
//oper.logg.Debugf("Calling BlobExists")
|
||||||
|
|
||||||
if params.Digest == "" {
|
if params.Digest == "" {
|
||||||
err = fmt.Errorf("Empty reference")
|
err = fmt.Errorf("Empty reference")
|
||||||
@@ -79,7 +79,8 @@ type PostUploadResult struct {
|
|||||||
func (oper *Operator) PostUpload(ctx context.Context, params *PostUploadParams) (*PostUploadResult, int, error) {
|
func (oper *Operator) PostUpload(ctx context.Context, params *PostUploadParams) (*PostUploadResult, int, error) {
|
||||||
var err error
|
var err error
|
||||||
res := &PostUploadResult{}
|
res := &PostUploadResult{}
|
||||||
oper.logg.Debugf("PostUpload")
|
|
||||||
|
//oper.logg.Debugf("Calling PostUpload")
|
||||||
|
|
||||||
if params.Digest == "" {
|
if params.Digest == "" {
|
||||||
uuid := auxuuid.NewUUID()
|
uuid := auxuuid.NewUUID()
|
||||||
@@ -116,7 +117,8 @@ type PatchUploadResult struct {
|
|||||||
func (oper *Operator) PatchUpload(ctx context.Context, params *PatchUploadParams) (*PatchUploadResult, int, error) {
|
func (oper *Operator) PatchUpload(ctx context.Context, params *PatchUploadParams) (*PatchUploadResult, int, error) {
|
||||||
var err error
|
var err error
|
||||||
res := &PatchUploadResult{}
|
res := &PatchUploadResult{}
|
||||||
oper.logg.Debugf("Call PatchUpload")
|
|
||||||
|
//oper.logg.Debugf("Calling PatchUpload")
|
||||||
|
|
||||||
if params.Reference == "" {
|
if params.Reference == "" {
|
||||||
err = fmt.Errorf("Empty 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) {
|
func (oper *Operator) PutUpload(ctx context.Context, params *PutUploadParams) (*PutUploadResult, int, error) {
|
||||||
var err error
|
var err error
|
||||||
res := &PutUploadResult{}
|
res := &PutUploadResult{}
|
||||||
oper.logg.Debugf("Call PutUpload")
|
|
||||||
|
//oper.logg.Debugf("Calling PutUpload")
|
||||||
|
|
||||||
if params.Reference == "" {
|
if params.Reference == "" {
|
||||||
err = fmt.Errorf("Empty 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) {
|
func (oper *Operator) GetBlob(ctx context.Context, params *GetBlobParams) (*GetBlobResult, int, error) {
|
||||||
var err error
|
var err error
|
||||||
res := &GetBlobResult{}
|
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 == "" {
|
if params.Name == "" {
|
||||||
err = fmt.Errorf("Empty 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) {
|
func (oper *Operator) DeleteBlob(ctx context.Context, params *DeleteBlobParams) (*DeleteBlobResult, int, error) {
|
||||||
var err error
|
var err error
|
||||||
res := &DeleteBlobResult{}
|
res := &DeleteBlobResult{}
|
||||||
oper.logg.Debugf("DeleteBlob")
|
|
||||||
|
//oper.logg.Debugf("Calling DeleteBlob")
|
||||||
|
|
||||||
if params.Digest == "" {
|
if params.Digest == "" {
|
||||||
err = fmt.Errorf("Empty 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) {
|
func (oper *Operator) PutManifest(ctx context.Context, params *PutManifestParams) (*PutManifestResult, int, error) {
|
||||||
var err error
|
var err error
|
||||||
res := &PutManifestResult{}
|
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 == "" {
|
if params.Reference == "" {
|
||||||
err = fmt.Errorf("Empty 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) {
|
func (oper *Operator) GetManifest(ctx context.Context, params *GetManifestParams) (*GetManifestResult, int, error) {
|
||||||
var err error
|
var err error
|
||||||
res := &GetManifestResult{}
|
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{}
|
manifestDescr := descr.Manifest{}
|
||||||
var exists bool
|
var exists bool
|
||||||
|
|||||||
@@ -3,9 +3,6 @@ package client
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
//"math/rand"
|
|
||||||
//"os"
|
|
||||||
//"path/filepath"
|
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@@ -25,10 +22,11 @@ func TestImageLife(t *testing.T) {
|
|||||||
{
|
{
|
||||||
err = srv.Configure()
|
err = srv.Configure()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
if false {
|
||||||
srv.SetDatadir(srvdir)
|
srv.SetDatadir(srvdir)
|
||||||
srv.SetLogdir(srvdir)
|
srv.SetLogdir(srvdir)
|
||||||
srv.SetRundir(srvdir)
|
srv.SetRundir(srvdir)
|
||||||
|
}
|
||||||
srv.SetPort(srvport)
|
srv.SetPort(srvport)
|
||||||
|
|
||||||
err = srv.Build()
|
err = srv.Build()
|
||||||
|
|||||||
Reference in New Issue
Block a user