frostfs-node/pkg/local_object_storage/metabase/exists.go
Leonard Lyubich 46e455dcae [#176] localstore: Implement shard methods via Metabase and BlobStor
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-11 17:19:37 +03:00

21 lines
406 B
Go

package meta
import (
"github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/pkg/errors"
)
// Exists checks if object is presented in metabase.
func (db *DB) Exists(addr *object.Address) (bool, error) {
// FIXME: temp solution, avoid direct Get usage
_, err := db.Get(addr)
if err != nil {
if errors.Is(err, errNotFound) {
return false, nil
}
return false, err
}
return true, nil
}