working commit
This commit is contained in:
@@ -42,6 +42,11 @@ func (oper *Operator) BlobExists(ctx context.Context, operatorID string, params
|
||||
err = fmt.Errorf("Empty name")
|
||||
return res, http.StatusBadRequest, err
|
||||
}
|
||||
|
||||
resName := params.Name
|
||||
oper.iLock.WaitAndLock(resName)
|
||||
defer oper.iLock.Done(resName)
|
||||
|
||||
// Check blob descriptor
|
||||
descrExists, blobDescr, err := oper.mdb.GetBlobByNameDigest(ctx, params.Digest, params.Digest)
|
||||
if err != nil {
|
||||
@@ -198,6 +203,10 @@ func (oper *Operator) PutUpload(ctx context.Context, operatorID string, params *
|
||||
return res, http.StatusBadRequest, err
|
||||
}
|
||||
|
||||
resName := params.Name
|
||||
oper.iLock.WaitAndLock(resName)
|
||||
defer oper.iLock.Done(resName)
|
||||
|
||||
var contentLength int64
|
||||
if params.ContentLength != "" {
|
||||
contentLength, err = strconv.ParseInt(params.ContentLength, 10, 64)
|
||||
@@ -247,6 +256,10 @@ func (oper *Operator) GetBlob(ctx context.Context, operatorID string, params *Ge
|
||||
return res, http.StatusBadRequest, err
|
||||
}
|
||||
|
||||
resName := params.Name
|
||||
oper.iLock.WaitAndLock(resName)
|
||||
defer oper.iLock.Done(resName)
|
||||
|
||||
blobExists, blobSize, err := oper.store.BlobExists(params.Digest)
|
||||
if err != nil {
|
||||
return res, http.StatusInternalServerError, err
|
||||
@@ -294,6 +307,11 @@ func (oper *Operator) DeleteBlob(ctx context.Context, operatorID string, params
|
||||
err = fmt.Errorf("Empty name")
|
||||
return res, http.StatusBadRequest, err
|
||||
}
|
||||
|
||||
resName := params.Name
|
||||
oper.iLock.WaitAndLock(resName)
|
||||
defer oper.iLock.Done(resName)
|
||||
|
||||
// Check namespace record
|
||||
descrExists, _, err := oper.mdb.GetBlobByNameDigest(ctx, params.Name, params.Digest)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user