diff --git a/Makefile b/Makefile index b89483762..676537f48 100644 --- a/Makefile +++ b/Makefile @@ -66,11 +66,14 @@ protoc: @GOPRIVATE=github.com/nspcc-dev go mod vendor # Install specific version for protobuf lib @go list -f '{{.Path}}/...@{{.Version}}' -m github.com/golang/protobuf | xargs go install -v + @GOBIN=$(abspath $(BIN)) go install -mod=mod -v github.com/nspcc-dev/neofs-api-go/v2/util/protogen # Protoc generate @for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \ echo "⇒ Processing $$f "; \ protoc \ --proto_path=.:./vendor:/usr/local/include \ + --plugin=protoc-gen-go-neofs=$(BIN)/protogen \ + --go-neofs_out=. --go-neofs_opt=paths=source_relative \ --go_out=. --go_opt=paths=source_relative \ --go-grpc_opt=require_unimplemented_servers=false \ --go-grpc_out=. --go-grpc_opt=paths=source_relative $$f; \ diff --git a/cmd/neofs-adm/internal/modules/morph/internal/types.pb.go b/cmd/neofs-adm/internal/modules/morph/internal/types.pb.go index 03c183877..e76a29ae5 100644 Binary files a/cmd/neofs-adm/internal/modules/morph/internal/types.pb.go and b/cmd/neofs-adm/internal/modules/morph/internal/types.pb.go differ diff --git a/go.mod b/go.mod index 1c9484efe..8c8cb11a3 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/neo-go v0.99.1-pre.0.20220609082921-2c9fb2044242 github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220601120906-3bec6657f5c5 // indirect - github.com/nspcc-dev/neofs-api-go/v2 v2.12.2 + github.com/nspcc-dev/neofs-api-go/v2 v2.12.3-0.20220620114558-454b5c0ed7e9 github.com/nspcc-dev/neofs-contract v0.15.1 github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.4.0.20220616082321-e986f4780721 github.com/nspcc-dev/tzhash v1.5.2 @@ -34,7 +34,7 @@ require ( go.uber.org/zap v1.18.1 golang.org/x/term v0.0.0-20210429154555-c04ba851c2a4 google.golang.org/grpc v1.41.0 - google.golang.org/protobuf v1.27.1 + google.golang.org/protobuf v1.28.0 ) require ( diff --git a/go.sum b/go.sum index 895a5b671..f2ff65ec2 100644 --- a/go.sum +++ b/go.sum @@ -399,8 +399,9 @@ github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220601120906-3bec6657f5c5 h1:bW github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220601120906-3bec6657f5c5/go.mod h1:QBE0I30F2kOAISNpT5oks82yF4wkkUq3SCfI3Hqgx/Y= github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= github.com/nspcc-dev/neofs-api-go/v2 v2.11.1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= -github.com/nspcc-dev/neofs-api-go/v2 v2.12.2 h1:ifV/c0bW1TPiEKZlNqhfZl8lzX0f6FokjYUaze/hlBk= github.com/nspcc-dev/neofs-api-go/v2 v2.12.2/go.mod h1:73j09Xa7I2zQbM3HCvAHnDHPYiiWnEHa1d6Z6RDMBLU= +github.com/nspcc-dev/neofs-api-go/v2 v2.12.3-0.20220620114558-454b5c0ed7e9 h1:nMZRx2YCg+COYNweherLYl11A39iAmdtu24L3inI3yE= +github.com/nspcc-dev/neofs-api-go/v2 v2.12.3-0.20220620114558-454b5c0ed7e9/go.mod h1:73j09Xa7I2zQbM3HCvAHnDHPYiiWnEHa1d6Z6RDMBLU= github.com/nspcc-dev/neofs-contract v0.15.1 h1:1r27t4SGKF7W1PRPOIfircEXHvALThNYNagT+SIabcA= github.com/nspcc-dev/neofs-contract v0.15.1/go.mod h1:kxO5ZTqdzFnRM5RMvM+Fhd+3GGrJo6AmG2ZyA9OCqqQ= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= @@ -956,8 +957,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkg/services/control/ir/service.go b/pkg/services/control/ir/service.go index 8f61c0c7c..dc04e4904 100644 --- a/pkg/services/control/ir/service.go +++ b/pkg/services/control/ir/service.go @@ -1,30 +1,5 @@ package control -import ( - "github.com/nspcc-dev/neofs-api-go/v2/util/proto" -) - -// StableMarshal reads binary representation of health check request body -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *HealthCheckRequest_Body) StableMarshal(buf []byte) ([]byte, error) { - return buf, nil -} - -// StableSize returns binary size of health check request body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *HealthCheckRequest_Body) StableSize() int { - return 0 -} - // SetBody sets health check request body. func (x *HealthCheckRequest) SetBody(v *HealthCheckRequest_Body) { if x != nil { @@ -32,33 +7,6 @@ func (x *HealthCheckRequest) SetBody(v *HealthCheckRequest_Body) { } } -// SetSignature sets signature of the health check request body. -func (x *HealthCheckRequest) SetSignature(body *Signature) { - if x != nil { - x.Signature = body - } -} - -// ReadSignedData reads signed data of health check request to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *HealthCheckRequest) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf) -} - -// SignedDataSize returns binary size of the signed data -// of health check request. -// -// Structures with the same field values have the same signed data size. -func (x *HealthCheckRequest) SignedDataSize() int { - return x.GetBody().StableSize() -} - // SetHealthStatus sets health status of the IR application. func (x *HealthCheckResponse_Body) SetHealthStatus(v HealthStatus) { if x != nil { @@ -66,79 +14,9 @@ func (x *HealthCheckResponse_Body) SetHealthStatus(v HealthStatus) { } } -const ( - _ = iota - healthRespBodyHealthStatusFNum -) - -// StableMarshal reads binary representation of health check response body -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *HealthCheckResponse_Body) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if sz := x.StableSize(); len(buf) < sz { - buf = make([]byte, sz) - } - - proto.EnumMarshal(healthRespBodyHealthStatusFNum, buf, int32(x.HealthStatus)) - - return buf -} - -// StableSize returns binary size of health check response body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *HealthCheckResponse_Body) StableSize() int { - if x == nil { - return 0 - } - - size := 0 - - size += proto.EnumSize(healthRespBodyHealthStatusFNum, int32(x.HealthStatus)) - - return size -} - // SetBody sets health check response body. func (x *HealthCheckResponse) SetBody(v *HealthCheckResponse_Body) { if x != nil { x.Body = v } } - -// SetSignature sets signature of the health check response body. -func (x *HealthCheckResponse) SetSignature(v *Signature) { - if x != nil { - x.Signature = v - } -} - -// ReadSignedData reads signed data of health check response to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *HealthCheckResponse) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns binary size of the signed data -// of health check response. -// -// Structures with the same field values have the same signed data size. -func (x *HealthCheckResponse) SignedDataSize() int { - return x.GetBody().StableSize() -} diff --git a/pkg/services/control/ir/service.pb.go b/pkg/services/control/ir/service.pb.go index 26a6120d0..bd6d26de9 100644 Binary files a/pkg/services/control/ir/service.pb.go and b/pkg/services/control/ir/service.pb.go differ diff --git a/pkg/services/control/ir/service_grpc.pb.go b/pkg/services/control/ir/service_grpc.pb.go index bfdfc845d..edd848127 100644 Binary files a/pkg/services/control/ir/service_grpc.pb.go and b/pkg/services/control/ir/service_grpc.pb.go differ diff --git a/pkg/services/control/ir/service_neofs.pb.go b/pkg/services/control/ir/service_neofs.pb.go new file mode 100644 index 000000000..77ce39f34 Binary files /dev/null and b/pkg/services/control/ir/service_neofs.pb.go differ diff --git a/pkg/services/control/ir/types.pb.go b/pkg/services/control/ir/types.pb.go index 4795b092c..13f4499ed 100644 Binary files a/pkg/services/control/ir/types.pb.go and b/pkg/services/control/ir/types.pb.go differ diff --git a/pkg/services/control/ir/types_neofs.pb.go b/pkg/services/control/ir/types_neofs.pb.go new file mode 100644 index 000000000..1eefff6de Binary files /dev/null and b/pkg/services/control/ir/types_neofs.pb.go differ diff --git a/pkg/services/control/service.go b/pkg/services/control/service.go index fc0bee472..f120b388e 100644 --- a/pkg/services/control/service.go +++ b/pkg/services/control/service.go @@ -1,30 +1,5 @@ package control -import ( - "github.com/nspcc-dev/neofs-api-go/v2/util/proto" -) - -// StableMarshal reads binary representation of health check request body -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *HealthCheckRequest_Body) StableMarshal(buf []byte) ([]byte, error) { - return buf, nil -} - -// StableSize returns binary size of health check request body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *HealthCheckRequest_Body) StableSize() int { - return 0 -} - // SetBody sets health check request body. func (x *HealthCheckRequest) SetBody(v *HealthCheckRequest_Body) { if x != nil { @@ -32,33 +7,6 @@ func (x *HealthCheckRequest) SetBody(v *HealthCheckRequest_Body) { } } -// SetSignature sets signature of the health check request body. -func (x *HealthCheckRequest) SetSignature(body *Signature) { - if x != nil { - x.Signature = body - } -} - -// ReadSignedData reads signed data of health check request to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *HealthCheckRequest) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf) -} - -// SignedDataSize returns binary size of the signed data -// of health check request. -// -// Structures with the same field values have the same signed data size. -func (x *HealthCheckRequest) SignedDataSize() int { - return x.GetBody().StableSize() -} - // SetNetmapStatus sets status of the storage node in NeoFS network map. func (x *HealthCheckResponse_Body) SetNetmapStatus(v NetmapStatus) { if x != nil { @@ -73,54 +21,6 @@ func (x *HealthCheckResponse_Body) SetHealthStatus(v HealthStatus) { } } -const ( - _ = iota - healthRespBodyStatusFNum - healthRespBodyHealthStatusFNum -) - -// StableMarshal reads binary representation of health check response body -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *HealthCheckResponse_Body) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if sz := x.StableSize(); len(buf) < sz { - buf = make([]byte, sz) - } - - var offset int - - offset = proto.EnumMarshal(healthRespBodyStatusFNum, buf[offset:], int32(x.NetmapStatus)) - proto.EnumMarshal(healthRespBodyHealthStatusFNum, buf[offset:], int32(x.HealthStatus)) - - return buf -} - -// StableSize returns binary size of health check response body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *HealthCheckResponse_Body) StableSize() int { - if x == nil { - return 0 - } - - size := 0 - - size += proto.EnumSize(healthRespBodyStatusFNum, int32(x.NetmapStatus)) - size += proto.EnumSize(healthRespBodyHealthStatusFNum, int32(x.HealthStatus)) - - return size -} - // SetBody sets health check response body. func (x *HealthCheckResponse) SetBody(v *HealthCheckResponse_Body) { if x != nil { @@ -128,54 +28,6 @@ func (x *HealthCheckResponse) SetBody(v *HealthCheckResponse_Body) { } } -// SetSignature sets signature of the health check response body. -func (x *HealthCheckResponse) SetSignature(v *Signature) { - if x != nil { - x.Signature = v - } -} - -// ReadSignedData reads signed data of health check response to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *HealthCheckResponse) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns binary size of the signed data -// of health check response. -// -// Structures with the same field values have the same signed data size. -func (x *HealthCheckResponse) SignedDataSize() int { - return x.GetBody().StableSize() -} - -// StableMarshal reads binary representation of netmap snapshot request body -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *NetmapSnapshotRequest_Body) StableMarshal(buf []byte) ([]byte, error) { - return buf, nil -} - -// StableSize returns binary size of netmap snapshot request body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *NetmapSnapshotRequest_Body) StableSize() int { - return 0 -} - // SetBody sets get netmap snapshot request body. func (x *NetmapSnapshotRequest) SetBody(v *NetmapSnapshotRequest_Body) { if x != nil { @@ -183,33 +35,6 @@ func (x *NetmapSnapshotRequest) SetBody(v *NetmapSnapshotRequest_Body) { } } -// SetSignature sets signature of the netmap snapshot request body. -func (x *NetmapSnapshotRequest) SetSignature(body *Signature) { - if x != nil { - x.Signature = body - } -} - -// ReadSignedData reads signed data of netmap snapshot request to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *NetmapSnapshotRequest) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf) -} - -// SignedDataSize returns binary size of the signed data -// of netmap snapshot request. -// -// Structures with the same field values have the same signed data size. -func (x *NetmapSnapshotRequest) SignedDataSize() int { - return x.GetBody().StableSize() -} - // SetNetmap sets structure of the current network map. func (x *NetmapSnapshotResponse_Body) SetNetmap(v *Netmap) { if x != nil { @@ -217,49 +42,6 @@ func (x *NetmapSnapshotResponse_Body) SetNetmap(v *Netmap) { } } -const ( - _ = iota - snapshotRespBodyNetmapFNum -) - -// StableMarshal reads binary representation of netmap snapshot response body -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *NetmapSnapshotResponse_Body) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if sz := x.StableSize(); len(buf) < sz { - buf = make([]byte, sz) - } - - proto.NestedStructureMarshal(snapshotRespBodyNetmapFNum, buf, x.Netmap) - - return buf -} - -// StableSize returns binary size of netmap snapshot response body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *NetmapSnapshotResponse_Body) StableSize() int { - if x == nil { - return 0 - } - - size := 0 - - size += proto.NestedStructureSize(snapshotRespBodyNetmapFNum, x.Netmap) - - return size -} - // SetBody sets get netmap snapshot response body. func (x *NetmapSnapshotResponse) SetBody(v *NetmapSnapshotResponse_Body) { if x != nil { @@ -267,33 +49,6 @@ func (x *NetmapSnapshotResponse) SetBody(v *NetmapSnapshotResponse_Body) { } } -// SetSignature sets signature of the get netmap snapshot response body. -func (x *NetmapSnapshotResponse) SetSignature(v *Signature) { - if x != nil { - x.Signature = v - } -} - -// ReadSignedData reads signed data of netmap snapshot response to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *NetmapSnapshotResponse) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns binary size of the signed data -// of netmap snapshot response. -// -// Structures with the same field values have the same signed data size. -func (x *NetmapSnapshotResponse) SignedDataSize() int { - return x.GetBody().StableSize() -} - // SetStatus sets new storage node status in NeoFS network map. func (x *SetNetmapStatusRequest_Body) SetStatus(v NetmapStatus) { if x != nil { @@ -301,49 +56,6 @@ func (x *SetNetmapStatusRequest_Body) SetStatus(v NetmapStatus) { } } -const ( - _ = iota - setNetmapStatusReqBodyStatusFNum -) - -// StableMarshal reads binary representation of set netmap status request body -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *SetNetmapStatusRequest_Body) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if sz := x.StableSize(); len(buf) < sz { - buf = make([]byte, sz) - } - - proto.EnumMarshal(setNetmapStatusReqBodyStatusFNum, buf, int32(x.Status)) - - return buf -} - -// StableSize returns binary size of netmap status response body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *SetNetmapStatusRequest_Body) StableSize() int { - if x == nil { - return 0 - } - - size := 0 - - size += proto.EnumSize(setNetmapStatusReqBodyStatusFNum, int32(x.Status)) - - return size -} - // SetBody sets body of the set netmap status request . func (x *SetNetmapStatusRequest) SetBody(v *SetNetmapStatusRequest_Body) { if x != nil { @@ -351,53 +63,6 @@ func (x *SetNetmapStatusRequest) SetBody(v *SetNetmapStatusRequest_Body) { } } -// SetSignature sets signature of the set netmap status request body. -func (x *SetNetmapStatusRequest) SetSignature(body *Signature) { - if x != nil { - x.Signature = body - } -} - -// ReadSignedData reads signed data of set netmap status request to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *SetNetmapStatusRequest) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns binary size of the signed data -// of set netmap status request. -// -// Structures with the same field values have the same signed data size. -func (x *SetNetmapStatusRequest) SignedDataSize() int { - return x.GetBody().StableSize() -} - -// StableMarshal reads binary representation of set netmap status response body -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *SetNetmapStatusResponse_Body) StableMarshal(buf []byte) []byte { - return buf -} - -// StableSize returns binary size of set netmap status response body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *SetNetmapStatusResponse_Body) StableSize() int { - return 0 -} - // SetBody sets set body of the netmap status response. func (x *SetNetmapStatusResponse) SetBody(v *SetNetmapStatusResponse_Body) { if x != nil { @@ -405,83 +70,13 @@ func (x *SetNetmapStatusResponse) SetBody(v *SetNetmapStatusResponse_Body) { } } -// SetSignature sets signature of the set netmap status response body. -func (x *SetNetmapStatusResponse) SetSignature(v *Signature) { - if x != nil { - x.Signature = v - } -} - -// ReadSignedData reads signed data of set netmap status response to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *SetNetmapStatusResponse) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns binary size of the signed data -// of set netmap status response. -// -// Structures with the same field values have the same signed data size. -func (x *SetNetmapStatusResponse) SignedDataSize() int { - return x.GetBody().StableSize() -} - -// SetAddressList sets a list of objects to be removed in NeoFS API binary format. +// SetAddressList sets list of objects to be removed in NeoFS API binary format. func (x *DropObjectsRequest_Body) SetAddressList(v [][]byte) { if x != nil { x.AddressList = v } } -const ( - _ = iota - addrListReqBodyStatusFNum -) - -// StableMarshal reads binary representation of "Drop objects" request body -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *DropObjectsRequest_Body) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if sz := x.StableSize(); len(buf) < sz { - buf = make([]byte, sz) - } - - proto.RepeatedBytesMarshal(addrListReqBodyStatusFNum, buf, x.AddressList) - - return buf -} - -// StableSize returns binary size of "Drop objects" response body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *DropObjectsRequest_Body) StableSize() int { - if x == nil { - return 0 - } - - size := 0 - - size += proto.RepeatedBytesSize(addrListReqBodyStatusFNum, x.AddressList) - - return size -} - // SetBody sets body of the set "Drop objects" request. func (x *DropObjectsRequest) SetBody(v *DropObjectsRequest_Body) { if x != nil { @@ -489,52 +84,6 @@ func (x *DropObjectsRequest) SetBody(v *DropObjectsRequest_Body) { } } -// SetSignature sets signature of the "Drop objects" request body. -func (x *DropObjectsRequest) SetSignature(body *Signature) { - if x != nil { - x.Signature = body - } -} - -// ReadSignedData reads signed data of "Drop objects" request to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *DropObjectsRequest) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns binary size of the signed data of "Drop objects" request. -// -// Structures with the same field values have the same signed data size. -func (x *DropObjectsRequest) SignedDataSize() int { - return x.GetBody().StableSize() -} - -// StableMarshal reads binary representation of "Drop objects" response body -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *DropObjectsResponse_Body) StableMarshal(buf []byte) []byte { - return buf -} - -// StableSize returns binary size of "Drop objects" response body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *DropObjectsResponse_Body) StableSize() int { - return 0 -} - // SetBody sets set body of the "Drop objects" response. func (x *DropObjectsResponse) SetBody(v *DropObjectsResponse_Body) { if x != nil { @@ -542,52 +91,6 @@ func (x *DropObjectsResponse) SetBody(v *DropObjectsResponse_Body) { } } -// SetSignature sets signature of the "Drop objects" response body. -func (x *DropObjectsResponse) SetSignature(v *Signature) { - if x != nil { - x.Signature = v - } -} - -// ReadSignedData reads signed data of "Drop objects" response to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *DropObjectsResponse) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns binary size of the signed data of "Drop objects" response. -// -// Structures with the same field values have the same signed data size. -func (x *DropObjectsResponse) SignedDataSize() int { - return x.GetBody().StableSize() -} - -// StableMarshal reads binary representation of list shards request body -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *ListShardsRequest_Body) StableMarshal(buf []byte) []byte { - return buf -} - -// StableSize returns binary size of list shards request body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *ListShardsRequest_Body) StableSize() int { - return 0 -} - // SetBody sets list shards request body. func (x *ListShardsRequest) SetBody(v *ListShardsRequest_Body) { if x != nil { @@ -595,33 +98,6 @@ func (x *ListShardsRequest) SetBody(v *ListShardsRequest_Body) { } } -// SetSignature sets signature of the list shards request body. -func (x *ListShardsRequest) SetSignature(body *Signature) { - if x != nil { - x.Signature = body - } -} - -// ReadSignedData reads signed data of list shards request to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *ListShardsRequest) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns binary size of the signed data -// of list shards request. -// -// Structures with the same field values have the same signed data size. -func (x *ListShardsRequest) SignedDataSize() int { - return x.GetBody().StableSize() -} - // SetShards sets shards of the storage node. func (x *ListShardsResponse_Body) SetShards(v []*ShardInfo) { if x != nil { @@ -629,55 +105,6 @@ func (x *ListShardsResponse_Body) SetShards(v []*ShardInfo) { } } -const ( - _ = iota - listShardsRespBodyShardsFNum -) - -// StableMarshal reads binary representation of list shards response body -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *ListShardsResponse_Body) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if sz := x.StableSize(); len(buf) < sz { - buf = make([]byte, sz) - } - - var offset int - - for i := range x.Shards { - offset += proto.NestedStructureMarshal(listShardsRespBodyShardsFNum, buf[offset:], x.Shards[i]) - } - - return buf -} - -// StableSize returns binary size of list shards response body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *ListShardsResponse_Body) StableSize() int { - if x == nil { - return 0 - } - - size := 0 - - for i := range x.Shards { - size += proto.NestedStructureSize(listShardsRespBodyShardsFNum, x.Shards[i]) - } - - return size -} - // SetBody sets list shards response body. func (x *ListShardsResponse) SetBody(v *ListShardsResponse_Body) { if x != nil { @@ -685,33 +112,6 @@ func (x *ListShardsResponse) SetBody(v *ListShardsResponse_Body) { } } -// SetSignature sets signature of the list shards response body. -func (x *ListShardsResponse) SetSignature(v *Signature) { - if x != nil { - x.Signature = v - } -} - -// ReadSignedData reads signed data of list shards response to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *ListShardsResponse) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns binary size of the signed data -// of list shards response. -// -// Structures with the same field values have the same signed data size. -func (x *ListShardsResponse) SignedDataSize() int { - return x.GetBody().StableSize() -} - // SetShardID sets shard ID whose mode is requested to be set. func (x *SetShardModeRequest_Body) SetShardID(v []byte) { if v != nil { @@ -729,55 +129,6 @@ func (x *SetShardModeRequest_Body) ClearErrorCounter(reset bool) { x.ResetErrorCounter = reset } -const ( - _ = iota - setShardModeReqBodyShardIDFNum - setShardModeReqBodyModeFNum - setShardModeReqBodyResetCounterFNum -) - -// StableMarshal reads binary representation of set shard mode request body -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *SetShardModeRequest_Body) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if sz := x.StableSize(); len(buf) < sz { - buf = make([]byte, sz) - } - - offset := proto.BytesMarshal(setShardModeReqBodyShardIDFNum, buf, x.Shard_ID) - offset += proto.EnumMarshal(setShardModeReqBodyModeFNum, buf[offset:], int32(x.Mode)) - proto.BoolMarshal(setShardModeReqBodyResetCounterFNum, buf[offset:], x.ResetErrorCounter) - - return buf -} - -// StableSize returns binary size of set shard mode response body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *SetShardModeRequest_Body) StableSize() int { - if x == nil { - return 0 - } - - size := 0 - - size += proto.BytesSize(setShardModeReqBodyShardIDFNum, x.Shard_ID) - size += proto.EnumSize(setShardModeReqBodyModeFNum, int32(x.Mode)) - size += proto.BoolSize(setShardModeReqBodyResetCounterFNum, x.ResetErrorCounter) - - return size -} - // SetBody sets request body. func (x *SetShardModeRequest) SetBody(v *SetShardModeRequest_Body) { if x != nil { @@ -785,53 +136,6 @@ func (x *SetShardModeRequest) SetBody(v *SetShardModeRequest_Body) { } } -// SetSignature sets signature of the request body. -func (x *SetShardModeRequest) SetSignature(v *Signature) { - if x != nil { - x.Signature = v - } -} - -// ReadSignedData reads signed data of the set shard mode request to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *SetShardModeRequest) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns binary size of the signed data -// of the set shard mode request. -// -// Structures with the same field values have the same signed data size. -func (x *SetShardModeRequest) SignedDataSize() int { - return x.GetBody().StableSize() -} - -// StableMarshal reads binary representation of the set shard mode response body -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *SetShardModeResponse_Body) StableMarshal(buf []byte) []byte { - return buf -} - -// StableSize returns binary size of the set shard mode response body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *SetShardModeResponse_Body) StableSize() int { - return 0 -} - // SetBody sets body of the set shard mode response. func (x *SetShardModeResponse) SetBody(v *SetShardModeResponse_Body) { if x != nil { @@ -839,33 +143,6 @@ func (x *SetShardModeResponse) SetBody(v *SetShardModeResponse_Body) { } } -// SetSignature sets signature of the set shard mode response body. -func (x *SetShardModeResponse) SetSignature(v *Signature) { - if x != nil { - x.Signature = v - } -} - -// ReadSignedData reads signed data of the set shard mode response to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *SetShardModeResponse) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns binary size of the signed data -// of the set shard mode response. -// -// Structures with the same field values have the same signed data size. -func (x *SetShardModeResponse) SignedDataSize() int { - return x.GetBody().StableSize() -} - // SetShardID sets shard ID for the dump shard request. func (x *DumpShardRequest_Body) SetShardID(id []byte) { x.Shard_ID = id @@ -881,53 +158,6 @@ func (x *DumpShardRequest_Body) SetIgnoreErrors(ignore bool) { x.IgnoreErrors = ignore } -const ( - _ = iota - dumpShardReqBodyShardIDFNum - dumpShardReqBodyFilepathFNum - dumpShardReqBodyIgnoreErrorsFNum -) - -// StableMarshal reads binary representation of request body binary format. -// -// If buffer length is less than StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *DumpShardRequest_Body) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if sz := x.StableSize(); len(buf) < sz { - buf = make([]byte, sz) - } - - offset := proto.BytesMarshal(dumpShardReqBodyShardIDFNum, buf, x.Shard_ID) - offset += proto.StringMarshal(dumpShardReqBodyFilepathFNum, buf[offset:], x.Filepath) - proto.BoolMarshal(dumpShardReqBodyIgnoreErrorsFNum, buf[offset:], x.IgnoreErrors) - - return buf -} - -// StableSize returns binary size of the request body in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *DumpShardRequest_Body) StableSize() int { - if x == nil { - return 0 - } - - size := 0 - - size += proto.BytesSize(dumpShardReqBodyShardIDFNum, x.Shard_ID) - size += proto.StringSize(dumpShardReqBodyFilepathFNum, x.Filepath) - size += proto.BoolSize(dumpShardReqBodyIgnoreErrorsFNum, x.IgnoreErrors) - - return size -} - // SetBody sets request body. func (x *DumpShardRequest) SetBody(v *DumpShardRequest_Body) { if x != nil { @@ -935,51 +165,6 @@ func (x *DumpShardRequest) SetBody(v *DumpShardRequest_Body) { } } -// SetSignature sets body signature of the request. -func (x *DumpShardRequest) SetSignature(v *Signature) { - if x != nil { - x.Signature = v - } -} - -// ReadSignedData reads signed data from request to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *DumpShardRequest) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns size of the request signed data in bytes. -// -// Structures with the same field values have the same signed data size. -func (x *DumpShardRequest) SignedDataSize() int { - return x.GetBody().StableSize() -} - -// StableMarshal reads binary representation of the response body in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *DumpShardResponse_Body) StableMarshal(buf []byte) []byte { - return buf -} - -// StableSize returns binary size of the response body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *DumpShardResponse_Body) StableSize() int { - return 0 -} - // SetBody sets response body. func (x *DumpShardResponse) SetBody(v *DumpShardResponse_Body) { if x != nil { @@ -987,32 +172,6 @@ func (x *DumpShardResponse) SetBody(v *DumpShardResponse_Body) { } } -// SetSignature sets response body signature. -func (x *DumpShardResponse) SetSignature(v *Signature) { - if x != nil { - x.Signature = v - } -} - -// ReadSignedData reads signed data from response to buf. -// -// If buffer length is less than SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *DumpShardResponse) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns binary size of the signed data. -// -// Structures with the same field values have the same signed data size. -func (x *DumpShardResponse) SignedDataSize() int { - return x.GetBody().StableSize() -} - // SetShardID sets shard ID for the restore shard request. func (x *RestoreShardRequest_Body) SetShardID(id []byte) { x.Shard_ID = id @@ -1028,53 +187,6 @@ func (x *RestoreShardRequest_Body) SetIgnoreErrors(ignore bool) { x.IgnoreErrors = ignore } -const ( - _ = iota - restoreShardReqBodyShardIDFNum - restoreShardReqBodyFilepathFNum - restoreShardReqBodyIgnoreErrorsFNum -) - -// StableMarshal reads binary representation of request body binary format. -// -// If buffer length is less than StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *RestoreShardRequest_Body) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if sz := x.StableSize(); len(buf) < sz { - buf = make([]byte, sz) - } - - offset := proto.BytesMarshal(restoreShardReqBodyShardIDFNum, buf, x.Shard_ID) - offset += proto.StringMarshal(restoreShardReqBodyFilepathFNum, buf[offset:], x.Filepath) - proto.BoolMarshal(restoreShardReqBodyIgnoreErrorsFNum, buf[offset:], x.IgnoreErrors) - - return buf -} - -// StableSize returns binary size of the request body in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *RestoreShardRequest_Body) StableSize() int { - if x == nil { - return 0 - } - - size := 0 - - size += proto.BytesSize(restoreShardReqBodyShardIDFNum, x.Shard_ID) - size += proto.StringSize(restoreShardReqBodyFilepathFNum, x.Filepath) - size += proto.BoolSize(restoreShardReqBodyIgnoreErrorsFNum, x.IgnoreErrors) - - return size -} - // SetBody sets request body. func (x *RestoreShardRequest) SetBody(v *RestoreShardRequest_Body) { if x != nil { @@ -1082,80 +194,9 @@ func (x *RestoreShardRequest) SetBody(v *RestoreShardRequest_Body) { } } -// SetSignature sets body signature of the request. -func (x *RestoreShardRequest) SetSignature(v *Signature) { - if x != nil { - x.Signature = v - } -} - -// ReadSignedData reads signed data from request to buf. -// -// If buffer length is less than x.SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *RestoreShardRequest) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns size of the request signed data in bytes. -// -// Structures with the same field values have the same signed data size. -func (x *RestoreShardRequest) SignedDataSize() int { - return x.GetBody().StableSize() -} - -// StableMarshal reads binary representation of the response body in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *RestoreShardResponse_Body) StableMarshal(buf []byte) []byte { - return buf -} - -// StableSize returns binary size of the response body -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *RestoreShardResponse_Body) StableSize() int { - return 0 -} - // SetBody sets response body. func (x *RestoreShardResponse) SetBody(v *RestoreShardResponse_Body) { if x != nil { x.Body = v } } - -// SetSignature sets response body signature. -func (x *RestoreShardResponse) SetSignature(v *Signature) { - if x != nil { - x.Signature = v - } -} - -// ReadSignedData reads signed data from response to buf. -// -// If buffer length is less than SignedDataSize(), new buffer is allocated. -// -// Returns any error encountered which did not allow writing the data completely. -// Otherwise, returns the buffer in which the data is written. -// -// Structures with the same field values have the same signed data. -func (x *RestoreShardResponse) ReadSignedData(buf []byte) ([]byte, error) { - return x.GetBody().StableMarshal(buf), nil -} - -// SignedDataSize returns binary size of the signed data. -// -// Structures with the same field values have the same signed data size. -func (x *RestoreShardResponse) SignedDataSize() int { - return x.GetBody().StableSize() -} diff --git a/pkg/services/control/service.pb.go b/pkg/services/control/service.pb.go index 87e8913a5..435cd25f3 100644 Binary files a/pkg/services/control/service.pb.go and b/pkg/services/control/service.pb.go differ diff --git a/pkg/services/control/service_grpc.pb.go b/pkg/services/control/service_grpc.pb.go index db08a63b5..5c088311a 100644 Binary files a/pkg/services/control/service_grpc.pb.go and b/pkg/services/control/service_grpc.pb.go differ diff --git a/pkg/services/control/service_neofs.pb.go b/pkg/services/control/service_neofs.pb.go new file mode 100644 index 000000000..3b4616e2f Binary files /dev/null and b/pkg/services/control/service_neofs.pb.go differ diff --git a/pkg/services/control/types.go b/pkg/services/control/types.go index 9c4fc09c7..4d4c11196 100644 --- a/pkg/services/control/types.go +++ b/pkg/services/control/types.go @@ -1,7 +1,6 @@ package control import ( - "github.com/nspcc-dev/neofs-api-go/v2/util/proto" "google.golang.org/protobuf/encoding/protojson" ) @@ -40,62 +39,6 @@ func (x *NodeInfo_Attribute) SetParents(v []string) { } } -const ( - _ = iota - nodeAttrKeyFNum - nodeAttrValueFNum - nodeAttrParentsFNum -) - -// StableMarshal reads binary representation of node attribute -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *NodeInfo_Attribute) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if sz := x.StableSize(); len(buf) < sz { - buf = make([]byte, sz) - } - - offset := proto.StringMarshal(nodeAttrKeyFNum, buf, x.Key) - offset += proto.StringMarshal(nodeAttrValueFNum, buf[offset:], x.Value) - - for i := range x.Parents { - offset += proto.StringMarshal(nodeAttrParentsFNum, buf[offset:], x.Parents[i]) - } - - return buf -} - -// StableSize returns binary size of node attribute -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *NodeInfo_Attribute) StableSize() int { - if x == nil { - return 0 - } - - size := 0 - - size += proto.StringSize(nodeAttrKeyFNum, x.Key) - size += proto.StringSize(nodeAttrValueFNum, x.Value) - - parents := x.GetParents() - for i := range parents { - size += proto.StringSize(nodeAttrParentsFNum, parents[i]) - } - - return size -} - // SetPublicKey sets public key of the NeoFS node in a binary format. func (x *NodeInfo) SetPublicKey(v []byte) { if x != nil { @@ -124,66 +67,6 @@ func (x *NodeInfo) SetState(v NetmapStatus) { } } -const ( - _ = iota - nodePubKeyFNum - nodeAddrFNum - nodeAttrsFNum - nodeStateFNum -) - -// StableMarshal reads binary representation of node information -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *NodeInfo) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if sz := x.StableSize(); len(buf) < sz { - buf = make([]byte, sz) - } - - offset := proto.BytesMarshal(nodePubKeyFNum, buf, x.PublicKey) - offset += proto.RepeatedStringMarshal(nodeAddrFNum, buf[offset:], x.Addresses) - - for i := range x.Attributes { - offset += proto.NestedStructureMarshal(nodeAttrsFNum, buf[offset:], x.Attributes[i]) - } - - proto.EnumMarshal(nodeStateFNum, buf[offset:], int32(x.State)) - - return buf -} - -// StableSize returns binary size of node information -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *NodeInfo) StableSize() int { - if x == nil { - return 0 - } - - size := 0 - - size += proto.BytesSize(nodePubKeyFNum, x.PublicKey) - size += proto.RepeatedStringSize(nodeAddrFNum, x.Addresses) - - for i := range x.Attributes { - size += proto.NestedStructureSize(nodeAttrsFNum, x.Attributes[i]) - } - - size += proto.EnumSize(nodeStateFNum, int32(x.State)) - - return size -} - // SetEpoch sets revision number of the network map. func (x *Netmap) SetEpoch(v uint64) { if x != nil { @@ -198,56 +81,6 @@ func (x *Netmap) SetNodes(v []*NodeInfo) { } } -const ( - _ = iota - netmapEpochFNum - netmapNodesFNum -) - -// StableMarshal reads binary representation of netmap in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *Netmap) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if sz := x.StableSize(); len(buf) < sz { - buf = make([]byte, sz) - } - - offset := proto.UInt64Marshal(netmapEpochFNum, buf, x.Epoch) - - for i := range x.Nodes { - offset += proto.NestedStructureMarshal(netmapNodesFNum, buf[offset:], x.Nodes[i]) - } - - return buf -} - -// StableSize returns binary size of netmap in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *Netmap) StableSize() int { - if x == nil { - return 0 - } - - size := 0 - - size += proto.UInt64Size(netmapEpochFNum, x.Epoch) - - for i := range x.Nodes { - size += proto.NestedStructureSize(netmapNodesFNum, x.Nodes[i]) - } - - return size -} - func (x *Netmap) MarshalJSON() ([]byte, error) { return protojson.MarshalOptions{ EmitUnpopulated: true, @@ -283,61 +116,3 @@ func (x *ShardInfo) SetMode(v ShardMode) { func (x *ShardInfo) SetErrorCount(count uint32) { x.ErrorCount = count } - -const ( - _ = iota - shardInfoIDFNum - shardInfoMetabaseFNum - shardInfoBlobstorFNum - shardInfoWriteCacheFNum - shardInfoModeFNum - shardInfoErrorCountFNum -) - -// StableSize returns binary size of shard information -// in protobuf binary format. -// -// Structures with the same field values have the same binary size. -func (x *ShardInfo) StableSize() int { - if x == nil { - return 0 - } - - size := 0 - - size += proto.BytesSize(shardInfoIDFNum, x.Shard_ID) - size += proto.StringSize(shardInfoMetabaseFNum, x.MetabasePath) - size += proto.StringSize(shardInfoBlobstorFNum, x.BlobstorPath) - size += proto.StringSize(shardInfoWriteCacheFNum, x.WritecachePath) - size += proto.EnumSize(shardInfoModeFNum, int32(x.Mode)) - size += proto.UInt32Size(shardInfoErrorCountFNum, x.ErrorCount) - - return size -} - -// StableMarshal reads binary representation of shard information -// in protobuf binary format. -// -// If buffer length is less than x.StableSize(), new buffer is allocated. -// -// Returns the buffer in which the data is written. -// -// Structures with the same field values have the same binary format. -func (x *ShardInfo) StableMarshal(buf []byte) []byte { - if x == nil { - return []byte{} - } - - if sz := x.StableSize(); len(buf) < sz { - buf = make([]byte, sz) - } - - offset := proto.BytesMarshal(shardInfoIDFNum, buf, x.Shard_ID) - offset += proto.StringMarshal(shardInfoMetabaseFNum, buf[offset:], x.MetabasePath) - offset += proto.StringMarshal(shardInfoBlobstorFNum, buf[offset:], x.BlobstorPath) - offset += proto.StringMarshal(shardInfoWriteCacheFNum, buf[offset:], x.WritecachePath) - offset += proto.EnumMarshal(shardInfoModeFNum, buf[offset:], int32(x.Mode)) - proto.EnumMarshal(shardInfoErrorCountFNum, buf[offset:], int32(x.ErrorCount)) - - return buf -} diff --git a/pkg/services/control/types.pb.go b/pkg/services/control/types.pb.go index 16a8b75b5..2b1ee9008 100644 Binary files a/pkg/services/control/types.pb.go and b/pkg/services/control/types.pb.go differ diff --git a/pkg/services/control/types_neofs.pb.go b/pkg/services/control/types_neofs.pb.go new file mode 100644 index 000000000..5fe19be94 Binary files /dev/null and b/pkg/services/control/types_neofs.pb.go differ