47d2239332
Replace ErrNotFound and ErrRangeOutOfBounds to core/object package in order to share them across the libraries. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
22 lines
477 B
Go
22 lines
477 B
Go
package meta
|
|
|
|
import (
|
|
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 *objectSDK.Address) (bool, error) {
|
|
// FIXME: temp solution, avoid direct Get usage
|
|
_, err := db.Get(addr)
|
|
if err != nil {
|
|
if errors.Is(err, object.ErrNotFound) {
|
|
return false, nil
|
|
}
|
|
|
|
return false, err
|
|
}
|
|
|
|
return true, nil
|
|
}
|