2020-11-17 17:39:43 +00:00
|
|
|
package meta
|
|
|
|
|
|
|
|
import (
|
2020-11-30 16:39:05 +00:00
|
|
|
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
2020-11-17 17:39:43 +00:00
|
|
|
"github.com/pkg/errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Exists checks if object is presented in metabase.
|
2020-11-30 16:39:05 +00:00
|
|
|
func (db *DB) Exists(addr *objectSDK.Address) (bool, error) {
|
2020-11-17 17:39:43 +00:00
|
|
|
// FIXME: temp solution, avoid direct Get usage
|
|
|
|
_, err := db.Get(addr)
|
|
|
|
if err != nil {
|
2020-11-30 16:39:05 +00:00
|
|
|
if errors.Is(err, object.ErrNotFound) {
|
2020-11-17 17:39:43 +00:00
|
|
|
return false, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return false, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return true, nil
|
|
|
|
}
|