diff --git a/pkg/local_object_storage/shard/exists.go b/pkg/local_object_storage/shard/exists.go index 9fa5e73a1d..9a25763a6e 100644 --- a/pkg/local_object_storage/shard/exists.go +++ b/pkg/local_object_storage/shard/exists.go @@ -2,6 +2,7 @@ package shard import ( "github.com/nspcc-dev/neofs-api-go/pkg/object" + "github.com/pkg/errors" ) // ExistsPrm groups the parameters of Exists operation. @@ -33,8 +34,16 @@ func (p *ExistsRes) Exists() bool { // Returns any error encountered that does not allow to // unambiguously determine the presence of an object. func (s *Shard) Exists(prm *ExistsPrm) (*ExistsRes, error) { - // FIXME: implement me + exists, err := s.objectExists(prm.addr) + if err != nil { + return nil, errors.Wrap(err, "could not check object presence in metabase") + } + return &ExistsRes{ - ex: false, + ex: exists, }, nil } + +func (s *Shard) objectExists(addr *object.Address) (bool, error) { + return s.metaBase.Exists(addr) +} diff --git a/pkg/local_object_storage/shard/put.go b/pkg/local_object_storage/shard/put.go index 411581dc32..29c74f8bc5 100644 --- a/pkg/local_object_storage/shard/put.go +++ b/pkg/local_object_storage/shard/put.go @@ -29,7 +29,7 @@ func (p *PutPrm) WithObject(obj *object.Object) *PutPrm { // did not allow to completely save the object. func (s *Shard) Put(prm *PutPrm) (*PutRes, error) { // check object existence - ex, err := s.metaBase.Exists(prm.obj.Address()) + ex, err := s.objectExists(prm.obj.Address()) if err != nil { return nil, errors.Wrap(err, "could not check object existence") } else if ex {