From e580ee991d9887322f84cdbb9afb1440068a3f9c Mon Sep 17 00:00:00 2001 From: Aleksey Savchuk Date: Wed, 18 Sep 2024 10:52:44 +0300 Subject: [PATCH] [#271] Drop handling of system attributes with NeoFS prefix Signed-off-by: Aleksey Savchuk --- container/container.go | 9 ++------- container/container_test.go | 2 +- object/object.go | 5 +---- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/container/container.go b/container/container.go index e2e796b..39c6259 100644 --- a/container/container.go +++ b/container/container.go @@ -356,8 +356,7 @@ func (x Container) IterateUserAttributes(f func(key, val string)) { attrs := x.v2.GetAttributes() for _, attr := range attrs { key := attr.GetKey() - if !strings.HasPrefix(key, container.SysAttributePrefix) && - !strings.HasPrefix(key, container.SysAttributePrefixNeoFS) { + if !strings.HasPrefix(key, container.SysAttributePrefix) { f(key, attr.GetValue()) } } @@ -417,8 +416,7 @@ func DisableHomomorphicHashing(cnr *Container) { // // Zero Container has enabled hashing. func IsHomomorphicHashingDisabled(cnr Container) bool { - return cnr.Attribute(container.SysAttributeHomomorphicHashing) == attributeHomoHashEnabled || - cnr.Attribute(container.SysAttributeHomomorphicHashingNeoFS) == attributeHomoHashEnabled + return cnr.Attribute(container.SysAttributeHomomorphicHashing) == attributeHomoHashEnabled } // Domain represents information about container domain registered in the NNS @@ -467,9 +465,6 @@ func ReadDomain(cnr Container) (res Domain) { if name := cnr.Attribute(container.SysAttributeName); name != "" { res.SetName(name) res.SetZone(cnr.Attribute(container.SysAttributeZone)) - } else if name = cnr.Attribute(container.SysAttributeNameNeoFS); name != "" { - res.SetName(name) - res.SetZone(cnr.Attribute(container.SysAttributeZoneNeoFS)) } return diff --git a/container/container_test.go b/container/container_test.go index d2ecf1d..c5f1b7e 100644 --- a/container/container_test.go +++ b/container/container_test.go @@ -150,7 +150,7 @@ func assertContainsAttribute(t *testing.T, m v2container.Container, key, val str } func TestContainer_Attribute(t *testing.T) { - const attrKey1, attrKey2 = v2container.SysAttributePrefix + "key1", v2container.SysAttributePrefixNeoFS + "key2" + const attrKey1, attrKey2 = v2container.SysAttributePrefix + "key1", v2container.SysAttributePrefix + "key2" const attrVal1, attrVal2 = "val1", "val2" val := containertest.Container() diff --git a/object/object.go b/object/object.go index 472e6fd..718a382 100644 --- a/object/object.go +++ b/object/object.go @@ -324,10 +324,7 @@ func (o *Object) UserAttributes() []Attribute { res := make([]Attribute, 0, len(attrs)) for _, attr := range attrs { - key := attr.GetKey() - - if !strings.HasPrefix(key, container.SysAttributePrefix) && - !strings.HasPrefix(key, container.SysAttributePrefixNeoFS) { + if !strings.HasPrefix(attr.GetKey(), container.SysAttributePrefix) { res = append(res, *NewAttributeFromV2(&attr)) } } -- 2.45.2