Support:
* new status codes (object, container, session);
* object `Lock` message;
* different signature schemes.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Define constant for `WrongMagicNumber` local code. Define constant
`DetailIDCorrect` for correct magic detail. Add `ResetDetails`
and `AppendDetails` method pair. Replace `SetDetails` method with new
`SetStatusDetails` function which can be implemented using new methods.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Remote gRPC server may not return or accept data for a while. gRPC
solves this issue with timeout in context. However, the context is
used for entire gRPC method invocation. Unfortunately the duration
of requests with streams can't be estimated easily.
To solve this issue we can specify timeouts for every message read
and write. Single message has size limit so timeout can be related
to that.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
Return any error other than `ErrRemoveSubnet` from `IterateSubnets`
during post-loop processing of zero subnet.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
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>
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>
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>
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>
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>
Implement `encoding.TextMarshaler` / `encoding.TextUnmarshaler` interfaces
on `SubnetID` according to NeoFS API V2 protocol.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Define `subnet.Info` structure of corresponding message from NeoFS API
protocol. Provide field getters and setters. Implement
`StableMarshal` / `StableSize` methods of binary encoding. Implement
`ToGRPCMessage` / `FromGRPCMessage` method for testing and
potential transport.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Implement `Fixed32Marshal` / `Fixed32Size` functions which allow to work
with protobuf fixed32 fields.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>