From ff6d8db7410b4d69cc8bacc7d5ad97681717c91e Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 18 Apr 2023 08:40:42 +0300 Subject: [PATCH] [#19] subnet: Drop related types and fields Signed-off-by: Dmitrii Stepanov --- container/attributes.go | 7 - container/grpc/types.pb.go | Bin 13664 -> 13484 bytes netmap/attributes.go | 232 ------------------------ netmap/attributes_test.go | 361 ------------------------------------- netmap/convert.go | 15 -- netmap/grpc/types.go | 7 - netmap/grpc/types.pb.go | Bin 47807 -> 45796 bytes netmap/marshal.go | 5 - netmap/test/generate.go | 1 - netmap/types.go | 9 - refs/convert.go | 28 --- refs/grpc/types.go | 5 - refs/grpc/types.pb.go | Bin 29099 -> 27235 bytes refs/marshal.go | 40 ---- refs/message_test.go | 1 - refs/test/generate.go | 10 - refs/types.go | 59 ------ refs/types_test.go | 72 -------- subnet/encoding_test.go | 15 -- subnet/grpc/types.go | 15 -- subnet/grpc/types.pb.go | Bin 6215 -> 0 bytes subnet/info.go | 138 -------------- subnet/test/generate.go | 17 -- 23 files changed, 1037 deletions(-) delete mode 100644 netmap/attributes.go delete mode 100644 netmap/attributes_test.go delete mode 100644 refs/types_test.go delete mode 100644 subnet/encoding_test.go delete mode 100644 subnet/grpc/types.go delete mode 100644 subnet/grpc/types.pb.go delete mode 100644 subnet/info.go delete mode 100644 subnet/test/generate.go diff --git a/container/attributes.go b/container/attributes.go index 1d7c94a..12277ed 100644 --- a/container/attributes.go +++ b/container/attributes.go @@ -4,9 +4,6 @@ package container const SysAttributePrefix = "__SYSTEM__" const ( - // SysAttributeSubnet is a string ID of container's storage subnet. - SysAttributeSubnet = SysAttributePrefix + "SUBNET" - // SysAttributeName is a string of human-friendly container name registered as the domain in NNS contract. SysAttributeName = SysAttributePrefix + "NAME" @@ -22,10 +19,6 @@ const ( const SysAttributePrefixNeoFS = "__NEOFS__" const ( - // SysAttributeSubnetNeoFS is a string ID of container's storage subnet. - // Deprecated: use SysAttributeSubnet - SysAttributeSubnetNeoFS = SysAttributePrefixNeoFS + "SUBNET" - // SysAttributeNameNeoFS is a string of human-friendly container name registered as the domain in NNS contract. // Deprecated: use SysAttributeName SysAttributeNameNeoFS = SysAttributePrefixNeoFS + "NAME" diff --git a/container/grpc/types.pb.go b/container/grpc/types.pb.go index 7f0cc1bc1851e013ea5006b883ce8ff8c91fff5c..0cd53eb0f167fe4e103aefa3271e1b3717f66bb1 100644 GIT binary patch delta 12 TcmaEmwI*{zzrbc^L0J_5C};%t delta 148 zcmZ3J`5*wOcY$A(y?}J z*L7^|I@&&CW3UhWq3DJJX_N#Z5Thg-MTsUl`7k69O(YSF#DC&B?=6WC|J>a3p7%WO z^E~f+&Y9Z<*RB_&j~)NBwGNJFORz&(l4}@MY-A0BYRyW5Pd-3#zpYK00R<4UrMp_br>)ba%qtBU#E zGA2iLIM%O4S&xk$Jso-(J9lYuIBkJ3yAYrB*svy0Tp&w0A1~t>nbA@hgD$L%SM%kj zpp4-F{q79dF(0%+ij?Cn zVuT0Eb@yc0u(8*U=3X;Wy=KBpSdmD&@LRHs$tfarf)8EEm8hRGp*2hf-DJeWVS6@e z#9Wx9oeRtOy>BT>BPI@08Ih4n8BrUe-9ff|DPCD9)-z(+?n)S=dLA&a#_<+x-%i~U zu`c?U#))XOii6BWWnAxj7AHuJLfDs2!j_eH&_KZC{Gu@S=NLF6y~> zb$C1KYn<>8`cheB!l|T6 zO%n3<`|wM51@;WDE+H;-_t+qxO;$mhs)3Ry$6uqX@qVBLtM|Qr_imthL~kN~UQU)5 z=R&Y!Y#FYMXfZVMIN{y5;rkCAp_9>hWUpVfg#b8D4BQP7vWI8=nh$x%3=f+!JeT$( zbEq7r(~USWR)Mli15=$%mSTNkF>|rup36dWsdTa-Mc3d8G-rLpPEcQ$4qTX6Q_2Le z`dpJ*hHv7JEO~yW--gX-;=VfLRX7iY|2igYaE?;+cD51kjXKdaT8nilH=|^IfOQ)0 zq?%P9$X7*XPgDg??2|}zJJY5Vrh%N~PD2QR!Q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@ -1,138 +0,0 @@ -package subnet - -import ( - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" - refsgrpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/grpc" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message" - subnet "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/subnet/grpc" - protoutil "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto" -) - -// Info represents information about NeoFS subnet. Structure is compatible with NeoFS API V2 protocol. -// -// Zero value represents zero subnet w/o an owner. -type Info struct { - id *refs.SubnetID - - owner *refs.OwnerID -} - -// ID returns identifier of the subnet. Nil return is equivalent to zero subnet ID. -func (x *Info) ID() *refs.SubnetID { - return x.id -} - -// SetID returns identifier of the subnet. Nil arg is equivalent to zero subnet ID. -func (x *Info) SetID(id *refs.SubnetID) { - x.id = id -} - -// Owner returns subnet owner's ID in NeoFS system. -func (x *Info) Owner() *refs.OwnerID { - return x.owner -} - -// SetOwner sets subnet owner's ID in NeoFS system. -func (x *Info) SetOwner(id *refs.OwnerID) { - x.owner = id -} - -// ToGRPCMessage forms subnet.SubnetInfo message and returns it as grpc.Message. -func (x *Info) ToGRPCMessage() grpc.Message { - var m *subnet.SubnetInfo - - if x != nil { - m = new(subnet.SubnetInfo) - - m.SetID(x.id.ToGRPCMessage().(*refsgrpc.SubnetID)) - m.SetOwner(x.owner.ToGRPCMessage().(*refsgrpc.OwnerID)) - } - - return m -} - -// FromGRPCMessage restores Info from grpc.Message. -// -// Supported types: -// - subnet.SubnetInfo. -func (x *Info) FromGRPCMessage(m grpc.Message) error { - v, ok := m.(*subnet.SubnetInfo) - if !ok { - return message.NewUnexpectedMessageType(m, v) - } - - var err error - - id := v.GetId() - if id == nil { - x.id = nil - } else { - if x.id == nil { - x.id = new(refs.SubnetID) - } - - err = x.id.FromGRPCMessage(id) - if err != nil { - return err - } - } - - ownerID := v.GetOwner() - if ownerID == nil { - x.owner = nil - } else { - if x.owner == nil { - x.owner = new(refs.OwnerID) - } - - err = x.owner.FromGRPCMessage(ownerID) - if err != nil { - return err - } - } - - return nil -} - -// SubnetInfo message field numbers -const ( - _ = iota - subnetInfoIDFNum - subnetInfoOwnerFNum -) - -// StableMarshal marshals Info to NeoFS API V2 binary format (Protocol Buffers with direct field order). -// -// Returns a slice of recorded data. Data is written to the provided buffer if there is enough space. -func (x *Info) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if buf == nil { - buf = make([]byte, x.StableSize()) - } - - var offset int - - offset += protoutil.NestedStructureMarshal(subnetInfoIDFNum, buf[offset:], x.id) - protoutil.NestedStructureMarshal(subnetInfoOwnerFNum, buf[offset:], x.owner) - - return buf -} - -// StableSize returns the number of bytes required to write Info in NeoFS API V2 binary format (see StableMarshal). -func (x *Info) StableSize() (size int) { - if x != nil { - size += protoutil.NestedStructureSize(subnetInfoIDFNum, x.id) - size += protoutil.NestedStructureSize(subnetInfoOwnerFNum, x.owner) - } - - return -} - -// Unmarshal decodes Info from NeoFS API V2 binary format (see StableMarshal). -func (x *Info) Unmarshal(data []byte) error { - return message.Unmarshal(x, data, new(subnet.SubnetInfo)) -} diff --git a/subnet/test/generate.go b/subnet/test/generate.go deleted file mode 100644 index 214ac7b..0000000 --- a/subnet/test/generate.go +++ /dev/null @@ -1,17 +0,0 @@ -package subnettest - -import ( - refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test" - "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/subnet" -) - -func GenerateSubnetInfo(empty bool) *subnet.Info { - m := new(subnet.Info) - - if !empty { - m.SetID(refstest.GenerateSubnetID(false)) - m.SetOwner(refstest.GenerateOwnerID(false)) - } - - return m -}