forked from TrueCloudLab/frostfs-api-go
[#10] Add __FROSTFS__ system attributes
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
c46cd37f71
commit
cd2e46a17c
5 changed files with 71 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue