Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support subnet attributes in NodeInfo #356

Closed
3 tasks
cthulhu-rider opened this issue Nov 16, 2021 · 0 comments · Fixed by #359
Closed
3 tasks

Support subnet attributes in NodeInfo #356

cthulhu-rider opened this issue Nov 16, 2021 · 0 comments · Fixed by #359
Assignees
Labels
enhancement Improving existing functionality
Milestone

Comments

@cthulhu-rider
Copy link
Contributor

cthulhu-rider commented Nov 16, 2021

Task

@cthulhu-rider cthulhu-rider added the enhancement Improving existing functionality label Nov 16, 2021
@cthulhu-rider cthulhu-rider added this to the v1.30 milestone Nov 16, 2021
@cthulhu-rider cthulhu-rider modified the milestones: v1.30, v1.31.0 Nov 16, 2021
@cthulhu-rider cthulhu-rider self-assigned this Nov 17, 2021
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 18, 2021
Add helper functions which provide ease of use with subnet zero IDs.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 18, 2021
Implement `encoding.TextMarshaler` / `encoding.TextUnmarshaler` interfaces
on `SubnetID` according to NeoFS API V2 protocol.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 18, 2021
…ubnets

NeoFS storage node can participate in a subnet group (at least one).
According to NeoFS API V2 protocol, subnets are entered and exited through
the attributes of the node. We should provide functionality for conveniently
setting and reading attributes based on the needs of the network.

Define `NodeSubnetInfo` type which groups information about the subnet
reflected in `NodeInfo`. Implement `WriteSubnetInfo` function which writes
`SubnetInfo` data to `NodeInfo`. It will be used to prepare a request for
registration on the NeoFS network. Implement `IterateSubnets` function which
allows to iterate over all subnets of the node. Moreover, it allows you to
remove a subnet from the `NodeInfo` right during iterative traversal.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 18, 2021
…ubnets

NeoFS storage node can participate in a subnet group (at least one).
According to NeoFS API V2 protocol, subnets are entered and exited through
the attributes of the node. We should provide functionality for conveniently
setting and reading attributes based on the needs of the network.

Define `NodeSubnetInfo` type which groups information about the subnet
reflected in `NodeInfo`. Implement `WriteSubnetInfo` function which writes
`SubnetInfo` data to `NodeInfo`. It will be used to prepare a request for
registration on the NeoFS network. Implement `IterateSubnets` function which
allows to iterate over all subnets of the node. Moreover, it allows you to
remove a subnet from the `NodeInfo` right during iterative traversal.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 18, 2021
…nets`

Each NeoFS storage node should be present in at least one subnet.

Make `netmap.IterateSubnets` function to return an error if the node by the
end of the loop does not belong to any subnet.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 19, 2021
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 22, 2021
Clarify the bit size limit in `SubnetID.UnmarshalText` method. Cover
overflow case in unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 22, 2021
Add `(*refs.SubnetID)(nil).MarshalText()` unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 22, 2021
…cate keys

Node attributes must be key-unique. In current implementation
`IterateSubnets` doesn't monitor the uniqueness of keys.

Declare undefined behavior of `IterateSubnets` for non-unique attribute
keys.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 22, 2021
Add both `False` and `True` subnet attributes.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 22, 2021
…bnets`

For now we don't need to distinguish cases of missing zero subnet's
attribute and the one with `True` value.

Remove local enum `zeroStatus` of `IterateSubnets` since we need to
distinguish between two statuses and use `bool` variable for this.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 22, 2021
…bnets`

For now we don't need to distinguish cases of missing zero subnet's
attribute and the one with `True` value.

Remove local enum `zeroStatus` of `IterateSubnets` since we need to
distinguish between two statuses and use `bool` variable for this.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 23, 2021
…bnets`

For now we don't need to distinguish cases of missing zero subnet's
attribute and the one with `True` value.

Remove local enum `zeroStatus` of `IterateSubnets` since we need to
distinguish between two statuses and use `bool` variable for this.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 23, 2021
API changes:
  * Rename `Enters` method of the `NodeSubnetInfo` to `Enabled`.
  * Declare undefined behavior of `WriteSubnetInfo` with non-unique
  attributes.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 23, 2021
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit to cthulhu-rider/neofs-api-go that referenced this issue Nov 23, 2021
…ateSubnets

Return any error other than `ErrRemoveSubnet` from `IterateSubnets`
during post-loop processing of zero subnet.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit that referenced this issue Nov 24, 2021
Add helper functions which provide ease of use with subnet zero IDs.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit that referenced this issue Nov 24, 2021
Implement `encoding.TextMarshaler` / `encoding.TextUnmarshaler` interfaces
on `SubnetID` according to NeoFS API V2 protocol.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit that referenced this issue Nov 24, 2021
NeoFS storage node can participate in a subnet group (at least one).
According to NeoFS API V2 protocol, subnets are entered and exited through
the attributes of the node. We should provide functionality for conveniently
setting and reading attributes based on the needs of the network.

Define `NodeSubnetInfo` type which groups information about the subnet
reflected in `NodeInfo`. Implement `WriteSubnetInfo` function which writes
`SubnetInfo` data to `NodeInfo`. It will be used to prepare a request for
registration on the NeoFS network. Implement `IterateSubnets` function which
allows to iterate over all subnets of the node. Moreover, it allows you to
remove a subnet from the `NodeInfo` right during iterative traversal.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit that referenced this issue Nov 24, 2021
Each NeoFS storage node should be present in at least one subnet.

Make `netmap.IterateSubnets` function to return an error if the node by the
end of the loop does not belong to any subnet.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit that referenced this issue Nov 24, 2021
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit that referenced this issue Nov 24, 2021
Clarify the bit size limit in `SubnetID.UnmarshalText` method. Cover
overflow case in unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit that referenced this issue Nov 24, 2021
Add `(*refs.SubnetID)(nil).MarshalText()` unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit that referenced this issue Nov 24, 2021
Node attributes must be key-unique. In current implementation
`IterateSubnets` doesn't monitor the uniqueness of keys.

Declare undefined behavior of `IterateSubnets` for non-unique attribute
keys.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit that referenced this issue Nov 24, 2021
Add both `False` and `True` subnet attributes.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit that referenced this issue Nov 24, 2021
For now we don't need to distinguish cases of missing zero subnet's
attribute and the one with `True` value.

Remove local enum `zeroStatus` of `IterateSubnets` since we need to
distinguish between two statuses and use `bool` variable for this.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit that referenced this issue Nov 24, 2021
API changes:
  * Rename `Enters` method of the `NodeSubnetInfo` to `Enabled`.
  * Declare undefined behavior of `WriteSubnetInfo` with non-unique
  attributes.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit that referenced this issue Nov 24, 2021
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
cthulhu-rider pushed a commit that referenced this issue Nov 24, 2021
Return any error other than `ErrRemoveSubnet` from `IterateSubnets`
during post-loop processing of zero subnet.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants