[#10] Add __FROSTFS__ system attributes

Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
Denis Kirillov 2023-03-06 15:24:58 +03:00
parent c46cd37f71
commit cd2e46a17c
5 changed files with 71 additions and 14 deletions

View file

@ -9,7 +9,10 @@ import (
)
// prefix of keys to subnet attributes.
const attrSubnetPrefix = "__NEOFS__SUBNET_"
const attrSubnetPrefix = "__FROSTFS__SUBNET_"
// prefix of keys to subnet attributes.
const attrSubnetPrefixNeoFS = "__NEOFS__SUBNET_"
const (
// subnet attribute's value denoting subnet entry
@ -62,7 +65,7 @@ func subnetAttributeKey(id *refs.SubnetID) string {
// - disables non-zero subnet;
// - enables zero subnet.
//
// Attribute key is calculated from ID using format `__NEOFS__SUBNET_%s`.
// Attribute key is calculated from ID using format `__FROSTFS__SUBNET_%s`.
// Attribute Value is:
// - `True` if node enters the subnet;
// - `False`, otherwise.
@ -143,8 +146,11 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error {
// cut subnet ID string
idTxt := strings.TrimPrefix(key, attrSubnetPrefix)
if len(idTxt) == len(key) {
// not a subnet attribute
continue
idTxt = strings.TrimPrefix(key, attrSubnetPrefixNeoFS)
if len(idTxt) == len(key) {
// not a subnet attribute
continue
}
}
// check value

View file

@ -11,7 +11,7 @@ import (
)
func subnetAttrKey(val string) string {
return "__NEOFS__SUBNET_" + val
return "__FROSTFS__SUBNET_" + val
}
func assertSubnetAttrKey(t *testing.T, attr *netmap.Attribute, num uint32) {