forked from TrueCloudLab/frostfs-node
[#211] blobstor: Remove global lock
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
59f7cf9873
commit
53b114cf8b
5 changed files with 0 additions and 16 deletions
|
@ -3,7 +3,6 @@ package blobstor
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -12,8 +11,6 @@ import (
|
||||||
// BlobStor represents NeoFS local BLOB storage.
|
// BlobStor represents NeoFS local BLOB storage.
|
||||||
type BlobStor struct {
|
type BlobStor struct {
|
||||||
*cfg
|
*cfg
|
||||||
|
|
||||||
mtx *sync.RWMutex
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Option represents BlobStor's constructor option.
|
// Option represents BlobStor's constructor option.
|
||||||
|
@ -57,7 +54,6 @@ func New(opts ...Option) *BlobStor {
|
||||||
|
|
||||||
return &BlobStor{
|
return &BlobStor{
|
||||||
cfg: c,
|
cfg: c,
|
||||||
mtx: new(sync.RWMutex),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,6 @@ type DeleteBigRes struct{}
|
||||||
//
|
//
|
||||||
// Returns ErrObjectNotFound if there is no object to delete.
|
// Returns ErrObjectNotFound if there is no object to delete.
|
||||||
func (b *BlobStor) DeleteBig(prm *DeleteBigPrm) (*DeleteBigRes, error) {
|
func (b *BlobStor) DeleteBig(prm *DeleteBigPrm) (*DeleteBigRes, error) {
|
||||||
b.mtx.Lock()
|
|
||||||
defer b.mtx.Unlock()
|
|
||||||
|
|
||||||
err := b.fsTree.delete(prm.addr)
|
err := b.fsTree.delete(prm.addr)
|
||||||
if errors.Is(err, errFileNotFound) {
|
if errors.Is(err, errFileNotFound) {
|
||||||
err = ErrObjectNotFound
|
err = ErrObjectNotFound
|
||||||
|
|
|
@ -27,9 +27,6 @@ var ErrObjectNotFound = errors.New("object not found")
|
||||||
// Returns any error encountered that
|
// Returns any error encountered that
|
||||||
// did not allow to completely read the object.
|
// did not allow to completely read the object.
|
||||||
func (b *BlobStor) GetBig(prm *GetBigPrm) (*GetBigRes, error) {
|
func (b *BlobStor) GetBig(prm *GetBigPrm) (*GetBigRes, error) {
|
||||||
b.mtx.RLock()
|
|
||||||
defer b.mtx.RUnlock()
|
|
||||||
|
|
||||||
// get compressed object data
|
// get compressed object data
|
||||||
data, err := b.fsTree.get(prm.addr)
|
data, err := b.fsTree.get(prm.addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -21,9 +21,6 @@ type GetRangeBigRes struct {
|
||||||
// Returns any error encountered that
|
// Returns any error encountered that
|
||||||
// did not allow to completely read the object payload range.
|
// did not allow to completely read the object payload range.
|
||||||
func (b *BlobStor) GetRangeBig(prm *GetRangeBigPrm) (*GetRangeBigRes, error) {
|
func (b *BlobStor) GetRangeBig(prm *GetRangeBigPrm) (*GetRangeBigRes, error) {
|
||||||
b.mtx.RLock()
|
|
||||||
defer b.mtx.RUnlock()
|
|
||||||
|
|
||||||
// get compressed object data
|
// get compressed object data
|
||||||
data, err := b.fsTree.get(prm.addr)
|
data, err := b.fsTree.get(prm.addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -28,9 +28,6 @@ type PutRes struct {
|
||||||
// Returns any error encountered that
|
// Returns any error encountered that
|
||||||
// did not allow to completely save the object.
|
// did not allow to completely save the object.
|
||||||
func (b *BlobStor) Put(prm *PutPrm) (*PutRes, error) {
|
func (b *BlobStor) Put(prm *PutPrm) (*PutRes, error) {
|
||||||
b.mtx.Lock()
|
|
||||||
defer b.mtx.Unlock()
|
|
||||||
|
|
||||||
// marshal object
|
// marshal object
|
||||||
data, err := prm.obj.Marshal()
|
data, err := prm.obj.Marshal()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue