[#312] netmap: Support multiple addresses in NodeInfo

In latest NeoFS API changes `NodeInfo` message carries list of network
addresses. There is a need

Add `SetAddresses` / `IterateAddresses` / `NumberOfAddresses` methods to
provide the access to node's address group. Mark `Address` / `SetAddress`
methods as deprecated.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-06-18 19:08:55 +03:00 committed by Leonard Lyubich
parent 6d531a07a5
commit 07fcaa4ba5
9 changed files with 159 additions and 70 deletions

View file

@ -367,7 +367,7 @@ func (ni *NodeInfo) StableMarshal(buf []byte) ([]byte, error) {
offset += n
n, err = protoutil.StringMarshal(addressNodeInfoField, buf[offset:], ni.address)
n, err = protoutil.RepeatedStringMarshal(addressNodeInfoField, buf[offset:], ni.addresses)
if err != nil {
return nil, err
}
@ -397,7 +397,8 @@ func (ni *NodeInfo) StableSize() (size int) {
}
size += protoutil.BytesSize(keyNodeInfoField, ni.publicKey)
size += protoutil.StringSize(addressNodeInfoField, ni.address)
size += protoutil.RepeatedStringSize(addressNodeInfoField, ni.addresses)
for i := range ni.attributes {
size += protoutil.NestedStructureSize(attributesNodeInfoField, ni.attributes[i])
}