frostfs-node/pkg/local_object_storage/metabase/exists.go
Leonard Lyubich 47d2239332 [#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 <leonard@nspcc.ru>
2020-12-11 17:19:37 +03:00

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
}