[#208] Remove childfree search attribute

With updated specification of object related operation
we don't have this search attribute any more and we
should not use functions related to this attribute.

This commit breaks object service logic, however it will
be fixed later.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-11-26 12:15:15 +03:00 committed by Alex Vanin
parent 46a43a778f
commit 6280d075b9
4 changed files with 3 additions and 32 deletions

View file

@ -63,8 +63,6 @@ func stringEqualMatcher(key, objVal, filterVal string) bool {
switch key { switch key {
default: default:
return objVal == filterVal return objVal == filterVal
case v2object.FilterPropertyChildfree:
return (filterVal == v2object.BooleanPropertyValueTrue) == (objVal == v2object.BooleanPropertyValueTrue)
case v2object.FilterPropertyPhy, v2object.FilterPropertyRoot: case v2object.FilterPropertyPhy, v2object.FilterPropertyRoot:
return true return true
} }

View file

@ -10,7 +10,6 @@ import (
"github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/container"
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/owner"
v2object "github.com/nspcc-dev/neofs-api-go/v2/object"
"github.com/nspcc-dev/neofs-node/pkg/core/object" "github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/util/test" "github.com/nspcc-dev/neofs-node/pkg/util/test"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -174,24 +173,7 @@ func TestDB_SelectProperties(t *testing.T) {
lnk.SetID(testOID()) lnk.SetID(testOID())
lnk.SetChildren(testOID()) lnk.SetChildren(testOID())
lnkAddr := lnk.Object().Address()
require.NoError(t, db.Put(lnk.Object())) require.NoError(t, db.Put(lnk.Object()))
// childfree filter
fs = fs[:0]
fs.AddChildfreeFilter()
testSelect(t, db, fs, childAddr, parAddr)
// non-childfree filter
fs = fs[:0]
fs.AddNonChildfreeFilter()
testSelect(t, db, fs, lnkAddr)
// childfree filter (with random false value)
fs = fs[:0]
fs.AddFilter(v2object.FilterPropertyChildfree, "some false value", objectSDK.MatchStringEqual)
testSelect(t, db, fs, lnkAddr)
} }
func TestDB_Path(t *testing.T) { func TestDB_Path(t *testing.T) {

View file

@ -96,12 +96,7 @@ func addressKey(addr *objectSDK.Address) []byte {
func objectIndices(obj *object.Object, parent bool) []bucketItem { func objectIndices(obj *object.Object, parent bool) []bucketItem {
as := obj.Attributes() as := obj.Attributes()
res := make([]bucketItem, 0, 7+len(as)) // 7 predefined buckets and object attributes res := make([]bucketItem, 0, 6+len(as)) // 6 predefined buckets and object attributes
childfreeVal := v2object.BooleanPropertyValueTrue
if len(obj.Children()) > 0 {
childfreeVal = ""
}
res = append(res, res = append(res,
bucketItem{ bucketItem{
@ -116,10 +111,6 @@ func objectIndices(obj *object.Object, parent bool) []bucketItem {
key: v2object.FilterHeaderOwnerID, key: v2object.FilterHeaderOwnerID,
val: obj.OwnerID().String(), val: obj.OwnerID().String(),
}, },
bucketItem{
key: v2object.FilterPropertyChildfree,
val: childfreeVal,
},
bucketItem{ bucketItem{
key: v2object.FilterHeaderParent, key: v2object.FilterHeaderParent,
val: obj.ParentID().String(), val: obj.ParentID().String(),

View file

@ -8,24 +8,24 @@ import (
// FIXME: this is a temporary solution for object fields filters // FIXME: this is a temporary solution for object fields filters
// fixme: remove it, it is broken now
func NewRightChildQuery(par *object.ID) query.Query { func NewRightChildQuery(par *object.ID) query.Query {
q := &Query{ q := &Query{
filters: make(object.SearchFilters, 0, 2), filters: make(object.SearchFilters, 0, 2),
} }
q.filters.AddFilter(v2object.FilterHeaderParent, idValue(par), object.MatchStringEqual) q.filters.AddFilter(v2object.FilterHeaderParent, idValue(par), object.MatchStringEqual)
q.filters.AddFilter(v2object.FilterPropertyChildfree, v2object.BooleanPropertyValueTrue, object.MatchStringEqual)
return q return q
} }
// fixme: remove it, it is broken now
func NewLinkingQuery(par *object.ID) query.Query { func NewLinkingQuery(par *object.ID) query.Query {
q := &Query{ q := &Query{
filters: make(object.SearchFilters, 0, 2), filters: make(object.SearchFilters, 0, 2),
} }
q.filters.AddFilter(v2object.FilterHeaderParent, idValue(par), object.MatchStringEqual) q.filters.AddFilter(v2object.FilterHeaderParent, idValue(par), object.MatchStringEqual)
q.filters.AddFilter(v2object.FilterPropertyChildfree, v2object.BooleanPropertyValueFalse, object.MatchStringEqual)
return q return q
} }