[#222] Update Exists method in shard

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-12-01 11:35:44 +03:00
parent 97a2e26b71
commit ccd8760fbc

View file

@ -2,7 +2,6 @@ package shard
import ( import (
"github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/pkg/errors"
) )
// ExistsPrm groups the parameters of Exists operation. // ExistsPrm groups the parameters of Exists operation.
@ -35,13 +34,10 @@ func (p *ExistsRes) Exists() bool {
// unambiguously determine the presence of an object. // unambiguously determine the presence of an object.
func (s *Shard) Exists(prm *ExistsPrm) (*ExistsRes, error) { func (s *Shard) Exists(prm *ExistsPrm) (*ExistsRes, error) {
exists, err := s.objectExists(prm.addr) exists, err := s.objectExists(prm.addr)
if err != nil {
return nil, errors.Wrap(err, "could not check object presence in metabase")
}
return &ExistsRes{ return &ExistsRes{
ex: exists, ex: exists,
}, nil }, err
} }
func (s *Shard) objectExists(addr *object.Address) (bool, error) { func (s *Shard) objectExists(addr *object.Address) (bool, error) {