[#37] container: Support legacy sys attributes

Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
Denis Kirillov 2023-03-16 11:01:44 +03:00
parent df2090c2be
commit bec77f280a

View file

@ -419,7 +419,8 @@ func DisableHomomorphicHashing(cnr *Container) {
// //
// Zero Container has enabled hashing. // Zero Container has enabled hashing.
func IsHomomorphicHashingDisabled(cnr Container) bool { func IsHomomorphicHashingDisabled(cnr Container) bool {
return cnr.Attribute(container.SysAttributeHomomorphicHashing) == attributeHomoHashEnabled return cnr.Attribute(container.SysAttributeHomomorphicHashing) == attributeHomoHashEnabled ||
cnr.Attribute(container.SysAttributeHomomorphicHashingNeoFS) == attributeHomoHashEnabled
} }
// Domain represents information about container domain registered in the NNS // Domain represents information about container domain registered in the NNS
@ -465,10 +466,12 @@ func WriteDomain(cnr *Container, domain Domain) {
// ReadDomain reads Domain from the Container. Returns value with empty name // ReadDomain reads Domain from the Container. Returns value with empty name
// if domain is not specified. // if domain is not specified.
func ReadDomain(cnr Container) (res Domain) { func ReadDomain(cnr Container) (res Domain) {
name := cnr.Attribute(container.SysAttributeName) if name := cnr.Attribute(container.SysAttributeName); name != "" {
if name != "" {
res.SetName(name) res.SetName(name)
res.SetZone(cnr.Attribute(container.SysAttributeZone)) res.SetZone(cnr.Attribute(container.SysAttributeZone))
} else if name = cnr.Attribute(container.SysAttributeNameNeoFS); name != "" {
res.SetName(name)
res.SetZone(cnr.Attribute(container.SysAttributeZoneNeoFS))
} }
return return