forked from TrueCloudLab/frostfs-api-go
[#355] subnet: Implement types for the new messages
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>
This commit is contained in:
parent
b0a2b73650
commit
580f6c5554
9 changed files with 279 additions and 0 deletions
19
subnet/grpc/types.go
Normal file
19
subnet/grpc/types.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package subnet
|
||||
|
||||
import (
|
||||
refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
|
||||
)
|
||||
|
||||
// SetID returns identifier of the subnet. Nil arg is equivalent to zero subnet ID.
|
||||
func (x *SubnetInfo) SetID(id *refs.SubnetID) {
|
||||
if x != nil {
|
||||
x.Id = id
|
||||
}
|
||||
}
|
||||
|
||||
// SetOwner sets subnet owner's ID in NeoFS system.
|
||||
func (x *SubnetInfo) SetOwner(id *refs.OwnerID) {
|
||||
if x != nil {
|
||||
x.Owner = id
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue