From 47d223933206c34c72fb0d4db9814504c6a2963d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 30 Nov 2020 19:39:05 +0300 Subject: [PATCH] [#220] localstorage: Replace basic errors to core library Replace ErrNotFound and ErrRangeOutOfBounds to core/object package in order to share them across the libraries. Signed-off-by: Leonard Lyubich --- pkg/core/object/errors.go | 11 +++++ .../blobovnicza/blobovnicza_test.go | 4 +- .../blobovnicza/delete.go | 5 ++- pkg/local_object_storage/blobovnicza/get.go | 8 ++-- .../blobovnicza/get_range.go | 9 ++-- .../blobstor/blobovnicza.go | 43 +++++++------------ .../blobstor/blobovnicza_test.go | 4 +- .../blobstor/delete_big.go | 9 ++-- pkg/local_object_storage/blobstor/get_big.go | 8 ++-- pkg/local_object_storage/engine/get.go | 9 ++-- pkg/local_object_storage/engine/head.go | 6 +-- pkg/local_object_storage/metabase/db_test.go | 2 +- pkg/local_object_storage/metabase/exists.go | 7 +-- pkg/local_object_storage/metabase/get.go | 10 ++--- pkg/local_object_storage/shard/get.go | 15 +------ 15 files changed, 68 insertions(+), 82 deletions(-) create mode 100644 pkg/core/object/errors.go diff --git a/pkg/core/object/errors.go b/pkg/core/object/errors.go new file mode 100644 index 000000000..fe872d293 --- /dev/null +++ b/pkg/core/object/errors.go @@ -0,0 +1,11 @@ +package object + +import "github.com/pkg/errors" + +// ErrNotFound is a basic "not found" error returned by +// object read functions. +var ErrNotFound = errors.New("object not found") + +// ErrRangeOutOfBounds is a basic error of violation of the boundaries of the +// payload of an object. +var ErrRangeOutOfBounds = errors.New("payload range is out of bounds") diff --git a/pkg/local_object_storage/blobovnicza/blobovnicza_test.go b/pkg/local_object_storage/blobovnicza/blobovnicza_test.go index aa070ef1d..158eba49f 100644 --- a/pkg/local_object_storage/blobovnicza/blobovnicza_test.go +++ b/pkg/local_object_storage/blobovnicza/blobovnicza_test.go @@ -109,7 +109,7 @@ func TestBlobovnicza(t *testing.T) { require.NoError(t, blz.Init()) // try to read non-existent address - testGet(t, blz, testAddress(), nil, ErrObjectNotFound) + testGet(t, blz, testAddress(), nil, object.ErrNotFound) filled := uint64(15 * 1 << 10) @@ -124,7 +124,7 @@ func TestBlobovnicza(t *testing.T) { require.NoError(t, err) // should return 404 - testGet(t, blz, addr, nil, ErrObjectNotFound) + testGet(t, blz, addr, nil, object.ErrNotFound) // fill Blobovnicza fully for ; filled < sizeLim; filled += objSizeLim { diff --git a/pkg/local_object_storage/blobovnicza/delete.go b/pkg/local_object_storage/blobovnicza/delete.go index e1d069ac4..a7974d635 100644 --- a/pkg/local_object_storage/blobovnicza/delete.go +++ b/pkg/local_object_storage/blobovnicza/delete.go @@ -2,6 +2,7 @@ package blobovnicza import ( objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-node/pkg/core/object" "go.etcd.io/bbolt" "go.uber.org/zap" ) @@ -25,7 +26,7 @@ func (p *DeletePrm) SetAddress(addr *objectSDK.Address) { // Returns any error encountered that // did not allow to completely delete the object. // -// Returns ErrObjectNotFound if the object to be deleted is not in blobovnicza. +// Returns ErrNotFound if the object to be deleted is not in blobovnicza. func (b *Blobovnicza) Delete(prm *DeletePrm) (*DeleteRes, error) { addrKey := addressKey(prm.addr) @@ -62,7 +63,7 @@ func (b *Blobovnicza) Delete(prm *DeletePrm) (*DeleteRes, error) { }) if err == nil && !removed { - err = ErrObjectNotFound + err = object.ErrNotFound } return nil, err diff --git a/pkg/local_object_storage/blobovnicza/get.go b/pkg/local_object_storage/blobovnicza/get.go index 327f0700f..c2350cec1 100644 --- a/pkg/local_object_storage/blobovnicza/get.go +++ b/pkg/local_object_storage/blobovnicza/get.go @@ -18,9 +18,6 @@ type GetRes struct { obj *object.Object } -// ErrObjectNotFound is returns on read operations requested on a missing object. -var ErrObjectNotFound = errors.New("object not found") - // SetAddress sets address of the requested object. func (p *GetPrm) SetAddress(addr *objectSDK.Address) { p.addr = addr @@ -35,6 +32,9 @@ func (p *GetRes) Object() *object.Object { // // Returns any error encountered that // did not allow to completely read the object. +// +// Returns ErrNotFound if requested object is not +// presented in Blobovnicza. func (b *Blobovnicza) Get(prm *GetPrm) (*GetRes, error) { var ( data []byte @@ -61,7 +61,7 @@ func (b *Blobovnicza) Get(prm *GetPrm) (*GetRes, error) { } if data == nil { - return nil, ErrObjectNotFound + return nil, object.ErrNotFound } // TODO: add decompression step diff --git a/pkg/local_object_storage/blobovnicza/get_range.go b/pkg/local_object_storage/blobovnicza/get_range.go index 4fc89c401..986de8b54 100644 --- a/pkg/local_object_storage/blobovnicza/get_range.go +++ b/pkg/local_object_storage/blobovnicza/get_range.go @@ -2,6 +2,7 @@ package blobovnicza import ( objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/pkg/errors" ) @@ -17,8 +18,6 @@ type GetRangeRes struct { rngData []byte } -var ErrRangeOutOfBounds = errors.New("payload range is out of bounds") - // SetAddress sets address of the requested object. func (p *GetRangePrm) SetAddress(addr *objectSDK.Address) { p.addr = addr @@ -38,6 +37,10 @@ func (p *GetRangeRes) RangeData() []byte { // // Returns any error encountered that // did not allow to completely read the object. +// +// Returns ErrNotFound if requested object is not +// presented in Blobovnicza. Returns ErrRangeOutOfBounds +// if requested range is outside the payload. func (b *Blobovnicza) GetRange(prm *GetRangePrm) (*GetRangeRes, error) { res, err := b.Get(&GetPrm{ addr: prm.addr, @@ -53,7 +56,7 @@ func (b *Blobovnicza) GetRange(prm *GetRangePrm) (*GetRangeRes, error) { if from > to { return nil, errors.Errorf("invalid range [%d:%d]", from, to) } else if uint64(len(payload)) < to { - return nil, ErrRangeOutOfBounds + return nil, object.ErrRangeOutOfBounds } return &GetRangeRes{ diff --git a/pkg/local_object_storage/blobstor/blobovnicza.go b/pkg/local_object_storage/blobstor/blobovnicza.go index 9d36f6ade..175af2cb7 100644 --- a/pkg/local_object_storage/blobstor/blobovnicza.go +++ b/pkg/local_object_storage/blobstor/blobovnicza.go @@ -9,6 +9,7 @@ import ( lru "github.com/hashicorp/golang-lru" "github.com/nspcc-dev/hrw" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobovnicza" "github.com/pkg/errors" "go.uber.org/zap" @@ -216,7 +217,7 @@ func (b *blobovniczas) get(prm *GetSmallPrm) (res *GetSmallRes, err error) { res, err = b.getObjectFromLevel(bPrm, p, !ok) if err != nil { - if !errors.Is(err, ErrObjectNotFound) { + if !errors.Is(err, object.ErrNotFound) { b.log.Debug("could not get object from level", zap.String("level", p), zap.String("error", err.Error()), @@ -232,7 +233,7 @@ func (b *blobovniczas) get(prm *GetSmallPrm) (res *GetSmallRes, err error) { if err == nil && res == nil { // not found in any blobovnicza - err = ErrObjectNotFound + err = object.ErrNotFound } return @@ -267,7 +268,7 @@ func (b *blobovniczas) delete(prm *DeleteSmallPrm) (res *DeleteSmallRes, err err res, err = b.deleteObjectFromLevel(bPrm, p, !ok) if err != nil { - if !errors.Is(err, ErrObjectNotFound) { + if !errors.Is(err, object.ErrNotFound) { b.log.Debug("could not remove object from level", zap.String("level", p), zap.String("error", err.Error()), @@ -287,7 +288,7 @@ func (b *blobovniczas) delete(prm *DeleteSmallPrm) (res *DeleteSmallRes, err err if err == nil && res == nil { // not found in any blobovnicza - err = ErrObjectNotFound + err = object.ErrNotFound } return @@ -322,7 +323,7 @@ func (b *blobovniczas) getRange(prm *GetRangeSmallPrm) (res *GetRangeSmallRes, e res, err = b.getRangeFromLevel(bPrm, p, !ok) if err != nil { - if !errors.Is(err, ErrObjectNotFound) { + if !errors.Is(err, object.ErrNotFound) { b.log.Debug("could not get object from level", zap.String("level", p), zap.String("error", err.Error()), @@ -338,7 +339,7 @@ func (b *blobovniczas) getRange(prm *GetRangeSmallPrm) (res *GetRangeSmallRes, e if err == nil && res == nil { // not found in any blobovnicza - err = ErrObjectNotFound + err = object.ErrNotFound } return @@ -359,7 +360,7 @@ func (b *blobovniczas) deleteObjectFromLevel(prm *blobovnicza.DeletePrm, blzPath if ok { if res, err := b.deleteObject(v.(*blobovnicza.Blobovnicza), prm); err == nil { return res, err - } else if !errors.Is(err, ErrObjectNotFound) { + } else if !errors.Is(err, object.ErrNotFound) { log.Debug("could not remove object from opened blobovnicza", zap.String("error", err.Error()), ) @@ -377,7 +378,7 @@ func (b *blobovniczas) deleteObjectFromLevel(prm *blobovnicza.DeletePrm, blzPath if ok && tryActive { if res, err := b.deleteObject(active.blz, prm); err == nil { return res, err - } else if !errors.Is(err, ErrObjectNotFound) { + } else if !errors.Is(err, object.ErrNotFound) { log.Debug("could not remove object from active blobovnicza", zap.String("error", err.Error()), ) @@ -391,7 +392,7 @@ func (b *blobovniczas) deleteObjectFromLevel(prm *blobovnicza.DeletePrm, blzPath // and it's pointless to open them). if u64FromHexString(path.Base(blzPath)) > active.ind { log.Debug("index is too big") - return nil, ErrObjectNotFound + return nil, object.ErrNotFound } // open blobovnicza (cached inside) @@ -418,7 +419,7 @@ func (b *blobovniczas) getObjectFromLevel(prm *blobovnicza.GetPrm, blzPath strin if ok { if res, err := b.getObject(v.(*blobovnicza.Blobovnicza), prm); err == nil { return res, err - } else if !errors.Is(err, ErrObjectNotFound) { + } else if !errors.Is(err, object.ErrNotFound) { log.Debug("could not read object from opened blobovnicza", zap.String("error", err.Error()), ) @@ -437,7 +438,7 @@ func (b *blobovniczas) getObjectFromLevel(prm *blobovnicza.GetPrm, blzPath strin if ok && tryActive { if res, err := b.getObject(active.blz, prm); err == nil { return res, err - } else if !errors.Is(err, ErrObjectNotFound) { + } else if !errors.Is(err, object.ErrNotFound) { log.Debug("could not get object from active blobovnicza", zap.String("error", err.Error()), ) @@ -451,7 +452,7 @@ func (b *blobovniczas) getObjectFromLevel(prm *blobovnicza.GetPrm, blzPath strin // and it's pointless to open them). if u64FromHexString(path.Base(blzPath)) > active.ind { log.Debug("index is too big") - return nil, ErrObjectNotFound + return nil, object.ErrNotFound } // open blobovnicza (cached inside) @@ -478,7 +479,7 @@ func (b *blobovniczas) getRangeFromLevel(prm *blobovnicza.GetRangePrm, blzPath s if ok { if res, err := b.getObjectRange(v.(*blobovnicza.Blobovnicza), prm); err == nil { return res, err - } else if !errors.Is(err, ErrObjectNotFound) { + } else if !errors.Is(err, object.ErrNotFound) { log.Debug("could not read payload range from opened blobovnicza", zap.String("error", err.Error()), ) @@ -497,7 +498,7 @@ func (b *blobovniczas) getRangeFromLevel(prm *blobovnicza.GetRangePrm, blzPath s if ok && tryActive { if res, err := b.getObjectRange(active.blz, prm); err == nil { return res, err - } else if !errors.Is(err, ErrObjectNotFound) { + } else if !errors.Is(err, object.ErrNotFound) { log.Debug("could not read payload range from active blobovnicza", zap.String("error", err.Error()), ) @@ -511,7 +512,7 @@ func (b *blobovniczas) getRangeFromLevel(prm *blobovnicza.GetRangePrm, blzPath s // and it's pointless to open them). if u64FromHexString(path.Base(blzPath)) > active.ind { log.Debug("index is too big") - return nil, ErrObjectNotFound + return nil, object.ErrNotFound } // open blobovnicza (cached inside) @@ -527,10 +528,6 @@ func (b *blobovniczas) getRangeFromLevel(prm *blobovnicza.GetRangePrm, blzPath s func (b *blobovniczas) deleteObject(blz *blobovnicza.Blobovnicza, prm *blobovnicza.DeletePrm) (*DeleteSmallRes, error) { _, err := blz.Delete(prm) if err != nil { - if errors.Is(err, blobovnicza.ErrObjectNotFound) { - err = ErrObjectNotFound - } - return nil, err } @@ -541,10 +538,6 @@ func (b *blobovniczas) deleteObject(blz *blobovnicza.Blobovnicza, prm *blobovnic func (b *blobovniczas) getObject(blz *blobovnicza.Blobovnicza, prm *blobovnicza.GetPrm) (*GetSmallRes, error) { res, err := blz.Get(prm) if err != nil { - if errors.Is(err, blobovnicza.ErrObjectNotFound) { - err = ErrObjectNotFound - } - return nil, err } @@ -559,10 +552,6 @@ func (b *blobovniczas) getObject(blz *blobovnicza.Blobovnicza, prm *blobovnicza. func (b *blobovniczas) getObjectRange(blz *blobovnicza.Blobovnicza, prm *blobovnicza.GetRangePrm) (*GetRangeSmallRes, error) { res, err := blz.GetRange(prm) if err != nil { - if errors.Is(err, blobovnicza.ErrObjectNotFound) { - err = ErrObjectNotFound - } - return nil, err } diff --git a/pkg/local_object_storage/blobstor/blobovnicza_test.go b/pkg/local_object_storage/blobstor/blobovnicza_test.go index 0d1e8754b..70074a871 100644 --- a/pkg/local_object_storage/blobstor/blobovnicza_test.go +++ b/pkg/local_object_storage/blobstor/blobovnicza_test.go @@ -152,9 +152,9 @@ func TestBlobovniczas(t *testing.T) { gPrm.SetAddress(addrList[i]) _, err = b.get(gPrm) - require.True(t, errors.Is(err, ErrObjectNotFound)) + require.True(t, errors.Is(err, object.ErrNotFound)) _, err = b.delete(dPrm) - require.True(t, errors.Is(err, ErrObjectNotFound)) + require.True(t, errors.Is(err, object.ErrNotFound)) } } diff --git a/pkg/local_object_storage/blobstor/delete_big.go b/pkg/local_object_storage/blobstor/delete_big.go index 1fdfd1f48..85e3fa94b 100644 --- a/pkg/local_object_storage/blobstor/delete_big.go +++ b/pkg/local_object_storage/blobstor/delete_big.go @@ -3,7 +3,8 @@ package blobstor import ( "os" - "github.com/nspcc-dev/neofs-api-go/pkg/object" + objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/pkg/errors" ) @@ -20,17 +21,17 @@ type DeleteBigRes struct{} // Returns any error encountered that did not allow // to completely remove the object. // -// Returns ErrObjectNotFound if there is no object to delete. +// Returns ErrNotFound if there is no object to delete. func (b *BlobStor) DeleteBig(prm *DeleteBigPrm) (*DeleteBigRes, error) { err := b.fsTree.delete(prm.addr) if errors.Is(err, errFileNotFound) { - err = ErrObjectNotFound + err = object.ErrNotFound } return nil, err } -func (t *fsTree) delete(addr *object.Address) error { +func (t *fsTree) delete(addr *objectSDK.Address) error { p, err := t.exists(addr) if err != nil { return err diff --git a/pkg/local_object_storage/blobstor/get_big.go b/pkg/local_object_storage/blobstor/get_big.go index 80171fc5a..9551a0cd5 100644 --- a/pkg/local_object_storage/blobstor/get_big.go +++ b/pkg/local_object_storage/blobstor/get_big.go @@ -19,19 +19,19 @@ type GetBigRes struct { roObject } -// ErrObjectNotFound is returns on read operations requested on a missing object. -var ErrObjectNotFound = errors.New("object not found") - // GetBig reads the object from shallow dir of BLOB storage by address. // // Returns any error encountered that // did not allow to completely read the object. +// +// Returns ErrNotFound if requested object is not +// presented in shallow dir. func (b *BlobStor) GetBig(prm *GetBigPrm) (*GetBigRes, error) { // get compressed object data data, err := b.fsTree.get(prm.addr) if err != nil { if errors.Is(err, errFileNotFound) { - return nil, ErrObjectNotFound + return nil, object.ErrNotFound } return nil, errors.Wrap(err, "could not read object from fs tree") diff --git a/pkg/local_object_storage/engine/get.go b/pkg/local_object_storage/engine/get.go index 8caf43024..92aaed349 100644 --- a/pkg/local_object_storage/engine/get.go +++ b/pkg/local_object_storage/engine/get.go @@ -21,9 +21,6 @@ type GetRes struct { obj *object.Object } -// ErrObjectNotFound is returns on read operations requested on a missing object. -var ErrObjectNotFound = errors.New("object not found") - // WithAddress is a Get option to set the address of the requested object. // // Option is required. @@ -59,7 +56,7 @@ func (r *GetRes) Object() *object.Object { // Returns any error encountered that // did not allow to completely read the object part. // -// Returns ErrObjectNotFound if requested object is missing in local storage. +// Returns ErrNotFound if requested object is missing in local storage. func (e *StorageEngine) Get(prm *GetPrm) (*GetRes, error) { var obj *object.Object @@ -75,7 +72,7 @@ func (e *StorageEngine) Get(prm *GetPrm) (*GetRes, error) { e.iterateOverSortedShards(prm.addr, func(sh *shard.Shard) (stop bool) { res, err := sh.Get(shPrm) if err != nil { - if !errors.Is(err, shard.ErrObjectNotFound) { + if !errors.Is(err, object.ErrNotFound) { // TODO: smth wrong with shard, need to be processed e.log.Warn("could not get object from shard", zap.Stringer("shard", sh.ID()), @@ -90,7 +87,7 @@ func (e *StorageEngine) Get(prm *GetPrm) (*GetRes, error) { }) if obj == nil { - return nil, ErrObjectNotFound + return nil, object.ErrNotFound } return &GetRes{ diff --git a/pkg/local_object_storage/engine/head.go b/pkg/local_object_storage/engine/head.go index b4a3fbdf4..19272ed5d 100644 --- a/pkg/local_object_storage/engine/head.go +++ b/pkg/local_object_storage/engine/head.go @@ -41,7 +41,7 @@ func (r *HeadRes) Header() *object.Object { // Returns any error encountered that // did not allow to completely read the object header. // -// Returns ErrObjectNotFound if requested object is missing in local storage. +// Returns ErrNotFound if requested object is missing in local storage. func (e *StorageEngine) Head(prm *HeadPrm) (*HeadRes, error) { var head *object.Object @@ -51,7 +51,7 @@ func (e *StorageEngine) Head(prm *HeadPrm) (*HeadRes, error) { e.iterateOverSortedShards(prm.addr, func(sh *shard.Shard) (stop bool) { res, err := sh.Get(shPrm) if err != nil { - if !errors.Is(err, shard.ErrObjectNotFound) { + if !errors.Is(err, object.ErrNotFound) { // TODO: smth wrong with shard, need to be processed e.log.Warn("could not get object from shard", zap.Stringer("shard", sh.ID()), @@ -66,7 +66,7 @@ func (e *StorageEngine) Head(prm *HeadPrm) (*HeadRes, error) { }) if head == nil { - return nil, ErrObjectNotFound + return nil, object.ErrNotFound } return &HeadRes{ diff --git a/pkg/local_object_storage/metabase/db_test.go b/pkg/local_object_storage/metabase/db_test.go index ea43ad801..b5fbeabed 100644 --- a/pkg/local_object_storage/metabase/db_test.go +++ b/pkg/local_object_storage/metabase/db_test.go @@ -244,7 +244,7 @@ func TestVirtualObject(t *testing.T) { // parent object must not be readable _, err = db.Get(parAddr) - require.True(t, errors.Is(err, errNotFound)) + require.True(t, errors.Is(err, object.ErrNotFound)) fs := objectSDK.SearchFilters{} diff --git a/pkg/local_object_storage/metabase/exists.go b/pkg/local_object_storage/metabase/exists.go index 3eeab905c..63b0a7f63 100644 --- a/pkg/local_object_storage/metabase/exists.go +++ b/pkg/local_object_storage/metabase/exists.go @@ -1,16 +1,17 @@ package meta import ( - "github.com/nspcc-dev/neofs-api-go/pkg/object" + objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/pkg/errors" ) // Exists checks if object is presented in metabase. -func (db *DB) Exists(addr *object.Address) (bool, error) { +func (db *DB) Exists(addr *objectSDK.Address) (bool, error) { // FIXME: temp solution, avoid direct Get usage _, err := db.Get(addr) if err != nil { - if errors.Is(err, errNotFound) { + if errors.Is(err, object.ErrNotFound) { return false, nil } diff --git a/pkg/local_object_storage/metabase/get.go b/pkg/local_object_storage/metabase/get.go index 21556bc5f..79f89da38 100644 --- a/pkg/local_object_storage/metabase/get.go +++ b/pkg/local_object_storage/metabase/get.go @@ -1,15 +1,11 @@ package meta import ( - "errors" - objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-node/pkg/core/object" "go.etcd.io/bbolt" ) -var errNotFound = errors.New("object not found") - // Get returns object header for specified address. func (db *DB) Get(addr *objectSDK.Address) (*object.Object, error) { var obj *object.Object @@ -19,17 +15,17 @@ func (db *DB) Get(addr *objectSDK.Address) (*object.Object, error) { // check if object marked as deleted if objectRemoved(tx, addrKey) { - return errNotFound + return object.ErrNotFound } primaryBucket := tx.Bucket(primaryBucket) if primaryBucket == nil { - return errNotFound + return object.ErrNotFound } data := primaryBucket.Get(addrKey) if data == nil { - return errNotFound + return object.ErrNotFound } var err error diff --git a/pkg/local_object_storage/shard/get.go b/pkg/local_object_storage/shard/get.go index 5bd7fa4f1..28e2ba3bc 100644 --- a/pkg/local_object_storage/shard/get.go +++ b/pkg/local_object_storage/shard/get.go @@ -1,8 +1,6 @@ package shard import ( - "errors" - objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor" @@ -22,9 +20,6 @@ type GetRes struct { obj *object.Object } -// ErrObjectNotFound is returns on read operations requested on a missing object. -var ErrObjectNotFound = errors.New("object not found") - // WithAddress is a Get option to set the address of the requested object. // // Option is required. @@ -72,7 +67,7 @@ func (r *GetRes) Object() *object.Object { // Returns any error encountered that // did not allow to completely read the object part. // -// Returns ErrObjectNotFound if requested object is missing in shard. +// Returns ErrNotFound if requested object is missing in shard. func (s *Shard) Get(prm *GetPrm) (*GetRes, error) { if prm.ln < 0 { // try to read from WriteCache @@ -84,10 +79,6 @@ func (s *Shard) Get(prm *GetPrm) (*GetRes, error) { res, err := s.blobStor.GetBig(getBigPrm) if err != nil { - if errors.Is(err, blobstor.ErrObjectNotFound) { - err = ErrObjectNotFound - } - return nil, err } @@ -120,10 +111,6 @@ func (s *Shard) Get(prm *GetPrm) (*GetRes, error) { res, err := s.blobStor.GetRangeBig(getRngBigPrm) if err != nil { - if errors.Is(err, blobstor.ErrObjectNotFound) { - err = ErrObjectNotFound - } - return nil, err }