From 53b114cf8bf2a82c7523f507b22515be01007203 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 25 Nov 2020 14:30:48 +0300 Subject: [PATCH] [#211] blobstor: Remove global lock Signed-off-by: Leonard Lyubich --- pkg/local_object_storage/blobstor/blobstor.go | 4 ---- pkg/local_object_storage/blobstor/delete_big.go | 3 --- pkg/local_object_storage/blobstor/get_big.go | 3 --- pkg/local_object_storage/blobstor/get_range_big.go | 3 --- pkg/local_object_storage/blobstor/put.go | 3 --- 5 files changed, 16 deletions(-) diff --git a/pkg/local_object_storage/blobstor/blobstor.go b/pkg/local_object_storage/blobstor/blobstor.go index e74f8468..1275037d 100644 --- a/pkg/local_object_storage/blobstor/blobstor.go +++ b/pkg/local_object_storage/blobstor/blobstor.go @@ -3,7 +3,6 @@ package blobstor import ( "encoding/hex" "os" - "sync" "github.com/nspcc-dev/neofs-node/pkg/util/logger" "go.uber.org/zap" @@ -12,8 +11,6 @@ import ( // BlobStor represents NeoFS local BLOB storage. type BlobStor struct { *cfg - - mtx *sync.RWMutex } // Option represents BlobStor's constructor option. @@ -57,7 +54,6 @@ func New(opts ...Option) *BlobStor { return &BlobStor{ cfg: c, - mtx: new(sync.RWMutex), } } diff --git a/pkg/local_object_storage/blobstor/delete_big.go b/pkg/local_object_storage/blobstor/delete_big.go index 2f51b1d2..1fdfd1f4 100644 --- a/pkg/local_object_storage/blobstor/delete_big.go +++ b/pkg/local_object_storage/blobstor/delete_big.go @@ -22,9 +22,6 @@ type DeleteBigRes struct{} // // Returns ErrObjectNotFound if there is no object to delete. func (b *BlobStor) DeleteBig(prm *DeleteBigPrm) (*DeleteBigRes, error) { - b.mtx.Lock() - defer b.mtx.Unlock() - err := b.fsTree.delete(prm.addr) if errors.Is(err, errFileNotFound) { err = ErrObjectNotFound diff --git a/pkg/local_object_storage/blobstor/get_big.go b/pkg/local_object_storage/blobstor/get_big.go index 1e5512b4..80171fc5 100644 --- a/pkg/local_object_storage/blobstor/get_big.go +++ b/pkg/local_object_storage/blobstor/get_big.go @@ -27,9 +27,6 @@ var ErrObjectNotFound = errors.New("object not found") // Returns any error encountered that // did not allow to completely read the object. func (b *BlobStor) GetBig(prm *GetBigPrm) (*GetBigRes, error) { - b.mtx.RLock() - defer b.mtx.RUnlock() - // get compressed object data data, err := b.fsTree.get(prm.addr) if err != nil { diff --git a/pkg/local_object_storage/blobstor/get_range_big.go b/pkg/local_object_storage/blobstor/get_range_big.go index ee3d5af4..c781df1d 100644 --- a/pkg/local_object_storage/blobstor/get_range_big.go +++ b/pkg/local_object_storage/blobstor/get_range_big.go @@ -21,9 +21,6 @@ type GetRangeBigRes struct { // Returns any error encountered that // did not allow to completely read the object payload range. func (b *BlobStor) GetRangeBig(prm *GetRangeBigPrm) (*GetRangeBigRes, error) { - b.mtx.RLock() - defer b.mtx.RUnlock() - // get compressed object data data, err := b.fsTree.get(prm.addr) if err != nil { diff --git a/pkg/local_object_storage/blobstor/put.go b/pkg/local_object_storage/blobstor/put.go index b62858fc..016cd57e 100644 --- a/pkg/local_object_storage/blobstor/put.go +++ b/pkg/local_object_storage/blobstor/put.go @@ -28,9 +28,6 @@ type PutRes struct { // Returns any error encountered that // did not allow to completely save the object. func (b *BlobStor) Put(prm *PutPrm) (*PutRes, error) { - b.mtx.Lock() - defer b.mtx.Unlock() - // marshal object data, err := prm.obj.Marshal() if err != nil {