[#191] v2/object: Rename leaf filter to phy

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-11-09 15:29:26 +03:00 committed by Alex Vanin
parent ef31dec43a
commit 91eade02cd
3 changed files with 18 additions and 18 deletions

View file

@ -70,7 +70,7 @@ const (
fKeyHomomorphicHash
fKeyParent
fKeyPropRoot
fKeyPropLeaf
fKeyPropPhy
fKeyPropChildfree
)
@ -98,8 +98,8 @@ func (k filterKey) String() string {
return v2object.FilterHeaderParent
case fKeyPropRoot:
return v2object.FilterPropertyRoot
case fKeyPropLeaf:
return v2object.FilterPropertyLeaf
case fKeyPropPhy:
return v2object.FilterPropertyPhy
case fKeyPropChildfree:
return v2object.FilterPropertyChildfree
}
@ -211,16 +211,16 @@ func (f *SearchFilters) AddNonRootFilter() {
f.addRootFilter(false)
}
func (f *SearchFilters) addLeafFilter(val bool) {
f.addReservedFilter(MatchStringEqual, fKeyPropLeaf, boolStringer(val))
func (f *SearchFilters) addPhyFilter(val bool) {
f.addReservedFilter(MatchStringEqual, fKeyPropPhy, boolStringer(val))
}
func (f *SearchFilters) AddLeafFilter() {
f.addLeafFilter(true)
func (f *SearchFilters) AddPhyFilter() {
f.addPhyFilter(true)
}
func (f *SearchFilters) AddNonLeafFilter() {
f.addLeafFilter(false)
func (f *SearchFilters) AddNonPhyFilter() {
f.addPhyFilter(false)
}
func (f *SearchFilters) addChildFreeFilter(val bool) {

View file

@ -81,31 +81,31 @@ func TestSearchFilters_AddNonRootFilter(t *testing.T) {
require.Equal(t, v2object.BooleanPropertyValueFalse, f.Value())
}
func TestSearchFilters_AddLeafFilter(t *testing.T) {
func TestSearchFilters_AddPhyFilter(t *testing.T) {
fs := new(object.SearchFilters)
fs.AddLeafFilter()
fs.AddPhyFilter()
require.Len(t, *fs, 1)
f := (*fs)[0]
require.Equal(t, object.MatchStringEqual, f.Operation())
require.Equal(t, v2object.FilterPropertyLeaf, f.Header())
require.Equal(t, v2object.FilterPropertyPhy, f.Header())
require.Equal(t, v2object.BooleanPropertyValueTrue, f.Value())
}
func TestSearchFilters_AddNonLeafFilter(t *testing.T) {
func TestSearchFilters_AddNonPhyFilter(t *testing.T) {
fs := new(object.SearchFilters)
fs.AddNonLeafFilter()
fs.AddNonPhyFilter()
require.Len(t, *fs, 1)
f := (*fs)[0]
require.Equal(t, object.MatchStringEqual, f.Operation())
require.Equal(t, v2object.FilterPropertyLeaf, f.Header())
require.Equal(t, v2object.FilterPropertyPhy, f.Header())
require.Equal(t, v2object.BooleanPropertyValueFalse, f.Value())
}

View file

@ -33,11 +33,11 @@ const (
)
const (
// FilterPropertyRoot is a filter key to check if an object is a top object in a split hierarchy.
// FilterPropertyRoot is a filter key to check if regular object is on top of split hierarchy.
FilterPropertyRoot = ReservedFilterPrefix + "ROOT"
// FilterPropertyLeaf is a filter key to check if an object is a leaf in a split hierarchy.
FilterPropertyLeaf = ReservedFilterPrefix + "LEAF"
// FilterPropertyPhy is a filter key to check if an object physically stored on a node.
FilterPropertyPhy = ReservedFilterPrefix + "PHY"
// FilterPropertyChildfree is a filter key to check if an object has empty children list in `Split` header.
FilterPropertyChildfree = ReservedFilterPrefix + "CHILDFREE"