forked from TrueCloudLab/frostfs-node
services/control: Autogenerate stable marshalers
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
d2d1694113
commit
0408acc40e
17 changed files with 1622 additions and 1320 deletions
3
Makefile
3
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; \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.19.1
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.19.4
|
||||
// source: cmd/neofs-adm/internal/modules/morph/internal/types.proto
|
||||
|
||||
package internal
|
||||
|
|
4
go.mod
4
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 (
|
||||
|
|
6
go.sum
6
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=
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
4
pkg/services/control/ir/service.pb.go
generated
4
pkg/services/control/ir/service.pb.go
generated
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.19.1
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.21.1
|
||||
// source: pkg/services/control/ir/service.proto
|
||||
|
||||
package control
|
||||
|
|
4
pkg/services/control/ir/service_grpc.pb.go
generated
4
pkg/services/control/ir/service_grpc.pb.go
generated
|
@ -1,4 +1,8 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.21.1
|
||||
// source: pkg/services/control/ir/service.proto
|
||||
|
||||
package control
|
||||
|
||||
|
|
156
pkg/services/control/ir/service_neofs.pb.go
generated
Normal file
156
pkg/services/control/ir/service_neofs.pb.go
generated
Normal file
|
@ -0,0 +1,156 @@
|
|||
// Code generated by protoc-gen-go-neofs. DO NOT EDIT.
|
||||
|
||||
package control
|
||||
|
||||
import "github.com/nspcc-dev/neofs-api-go/v2/util/proto"
|
||||
|
||||
// StableSize returns the size of x in protobuf format.
|
||||
//
|
||||
// Structures with the same field values have the same binary size.
|
||||
func (x *HealthCheckRequest_Body) StableSize() (size int) {
|
||||
return size
|
||||
}
|
||||
|
||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
||||
//
|
||||
// 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 {
|
||||
return buf
|
||||
}
|
||||
|
||||
// StableSize returns the size of x in protobuf format.
|
||||
//
|
||||
// Structures with the same field values have the same binary size.
|
||||
func (x *HealthCheckRequest) StableSize() (size int) {
|
||||
size += proto.NestedStructureSize(1, x.Body)
|
||||
size += proto.NestedStructureSize(2, x.Signature)
|
||||
return size
|
||||
}
|
||||
|
||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
||||
//
|
||||
// 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) StableMarshal(buf []byte) []byte {
|
||||
if x == nil {
|
||||
return []byte{}
|
||||
}
|
||||
if buf == nil {
|
||||
buf = make([]byte, x.StableSize())
|
||||
}
|
||||
var offset int
|
||||
offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body)
|
||||
offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature)
|
||||
return buf
|
||||
}
|
||||
|
||||
// ReadSignedData fills buf with signed data of x.
|
||||
// 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) SignedDataSize() int {
|
||||
return x.GetBody().StableSize()
|
||||
}
|
||||
|
||||
// SignedDataSize returns size of the request signed data in bytes.
|
||||
//
|
||||
// Structures with the same field values have the same signed data size.
|
||||
func (x *HealthCheckRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
||||
return x.GetBody().StableMarshal(buf), nil
|
||||
}
|
||||
|
||||
func (x *HealthCheckRequest) SetSignature(sig *Signature) {
|
||||
x.Signature = sig
|
||||
}
|
||||
|
||||
// StableSize returns the size of x in protobuf format.
|
||||
//
|
||||
// Structures with the same field values have the same binary size.
|
||||
func (x *HealthCheckResponse_Body) StableSize() (size int) {
|
||||
size += proto.EnumSize(1, int32(x.HealthStatus))
|
||||
return size
|
||||
}
|
||||
|
||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
||||
//
|
||||
// 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 *HealthCheckResponse_Body) StableMarshal(buf []byte) []byte {
|
||||
if x == nil {
|
||||
return []byte{}
|
||||
}
|
||||
if buf == nil {
|
||||
buf = make([]byte, x.StableSize())
|
||||
}
|
||||
var offset int
|
||||
offset += proto.EnumMarshal(1, buf[offset:], int32(x.HealthStatus))
|
||||
return buf
|
||||
}
|
||||
|
||||
// StableSize returns the size of x in protobuf format.
|
||||
//
|
||||
// Structures with the same field values have the same binary size.
|
||||
func (x *HealthCheckResponse) StableSize() (size int) {
|
||||
size += proto.NestedStructureSize(1, x.Body)
|
||||
size += proto.NestedStructureSize(2, x.Signature)
|
||||
return size
|
||||
}
|
||||
|
||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
||||
//
|
||||
// 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 *HealthCheckResponse) StableMarshal(buf []byte) []byte {
|
||||
if x == nil {
|
||||
return []byte{}
|
||||
}
|
||||
if buf == nil {
|
||||
buf = make([]byte, x.StableSize())
|
||||
}
|
||||
var offset int
|
||||
offset += proto.NestedStructureMarshal(1, buf[offset:], x.Body)
|
||||
offset += proto.NestedStructureMarshal(2, buf[offset:], x.Signature)
|
||||
return buf
|
||||
}
|
||||
|
||||
// ReadSignedData fills buf with signed data of x.
|
||||
// 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) SignedDataSize() int {
|
||||
return x.GetBody().StableSize()
|
||||
}
|
||||
|
||||
// SignedDataSize returns size of the request signed data in bytes.
|
||||
//
|
||||
// Structures with the same field values have the same signed data size.
|
||||
func (x *HealthCheckResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
||||
return x.GetBody().StableMarshal(buf), nil
|
||||
}
|
||||
|
||||
func (x *HealthCheckResponse) SetSignature(sig *Signature) {
|
||||
x.Signature = sig
|
||||
}
|
4
pkg/services/control/ir/types.pb.go
generated
4
pkg/services/control/ir/types.pb.go
generated
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.19.1
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.21.1
|
||||
// source: pkg/services/control/ir/types.proto
|
||||
|
||||
package control
|
||||
|
|
35
pkg/services/control/ir/types_neofs.pb.go
generated
Normal file
35
pkg/services/control/ir/types_neofs.pb.go
generated
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Code generated by protoc-gen-go-neofs. DO NOT EDIT.
|
||||
|
||||
package control
|
||||
|
||||
import "github.com/nspcc-dev/neofs-api-go/v2/util/proto"
|
||||
|
||||
// StableSize returns the size of x in protobuf format.
|
||||
//
|
||||
// Structures with the same field values have the same binary size.
|
||||
func (x *Signature) StableSize() (size int) {
|
||||
size += proto.BytesSize(1, x.Key)
|
||||
size += proto.BytesSize(2, x.Sign)
|
||||
return size
|
||||
}
|
||||
|
||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
||||
//
|
||||
// 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 *Signature) StableMarshal(buf []byte) []byte {
|
||||
if x == nil {
|
||||
return []byte{}
|
||||
}
|
||||
if buf == nil {
|
||||
buf = make([]byte, x.StableSize())
|
||||
}
|
||||
var offset int
|
||||
offset += proto.BytesMarshal(1, buf[offset:], x.Key)
|
||||
offset += proto.BytesMarshal(2, buf[offset:], x.Sign)
|
||||
return buf
|
||||
}
|
File diff suppressed because it is too large
Load diff
2
pkg/services/control/service.pb.go
generated
2
pkg/services/control/service.pb.go
generated
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.19.4
|
||||
// protoc v3.21.1
|
||||
// source: pkg/services/control/service.proto
|
||||
|
||||
package control
|
||||
|
|
2
pkg/services/control/service_grpc.pb.go
generated
2
pkg/services/control/service_grpc.pb.go
generated
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.19.4
|
||||
// - protoc v3.21.1
|
||||
// source: pkg/services/control/service.proto
|
||||
|
||||
package control
|
||||
|
|
1231
pkg/services/control/service_neofs.pb.go
generated
Normal file
1231
pkg/services/control/service_neofs.pb.go
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -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
|
||||
}
|
||||
|
|
2
pkg/services/control/types.pb.go
generated
2
pkg/services/control/types.pb.go
generated
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.19.4
|
||||
// protoc v3.21.1
|
||||
// source: pkg/services/control/types.proto
|
||||
|
||||
package control
|
||||
|
|
177
pkg/services/control/types_neofs.pb.go
generated
Normal file
177
pkg/services/control/types_neofs.pb.go
generated
Normal file
|
@ -0,0 +1,177 @@
|
|||
// Code generated by protoc-gen-go-neofs. DO NOT EDIT.
|
||||
|
||||
package control
|
||||
|
||||
import "github.com/nspcc-dev/neofs-api-go/v2/util/proto"
|
||||
|
||||
// StableSize returns the size of x in protobuf format.
|
||||
//
|
||||
// Structures with the same field values have the same binary size.
|
||||
func (x *Signature) StableSize() (size int) {
|
||||
size += proto.BytesSize(1, x.Key)
|
||||
size += proto.BytesSize(2, x.Sign)
|
||||
return size
|
||||
}
|
||||
|
||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
||||
//
|
||||
// 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 *Signature) StableMarshal(buf []byte) []byte {
|
||||
if x == nil {
|
||||
return []byte{}
|
||||
}
|
||||
if buf == nil {
|
||||
buf = make([]byte, x.StableSize())
|
||||
}
|
||||
var offset int
|
||||
offset += proto.BytesMarshal(1, buf[offset:], x.Key)
|
||||
offset += proto.BytesMarshal(2, buf[offset:], x.Sign)
|
||||
return buf
|
||||
}
|
||||
|
||||
// StableSize returns the size of x in protobuf format.
|
||||
//
|
||||
// Structures with the same field values have the same binary size.
|
||||
func (x *NodeInfo_Attribute) StableSize() (size int) {
|
||||
size += proto.StringSize(1, x.Key)
|
||||
size += proto.StringSize(2, x.Value)
|
||||
size += proto.RepeatedStringSize(3, x.Parents)
|
||||
return size
|
||||
}
|
||||
|
||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
||||
//
|
||||
// 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 *NodeInfo_Attribute) StableMarshal(buf []byte) []byte {
|
||||
if x == nil {
|
||||
return []byte{}
|
||||
}
|
||||
if buf == nil {
|
||||
buf = make([]byte, x.StableSize())
|
||||
}
|
||||
var offset int
|
||||
offset += proto.StringMarshal(1, buf[offset:], x.Key)
|
||||
offset += proto.StringMarshal(2, buf[offset:], x.Value)
|
||||
offset += proto.RepeatedStringMarshal(3, buf[offset:], x.Parents)
|
||||
return buf
|
||||
}
|
||||
|
||||
// StableSize returns the size of x in protobuf format.
|
||||
//
|
||||
// Structures with the same field values have the same binary size.
|
||||
func (x *NodeInfo) StableSize() (size int) {
|
||||
size += proto.BytesSize(1, x.PublicKey)
|
||||
size += proto.RepeatedStringSize(2, x.Addresses)
|
||||
for i := range x.Attributes {
|
||||
size += proto.NestedStructureSize(3, x.Attributes[i])
|
||||
}
|
||||
size += proto.EnumSize(4, int32(x.State))
|
||||
return size
|
||||
}
|
||||
|
||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
||||
//
|
||||
// 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 *NodeInfo) StableMarshal(buf []byte) []byte {
|
||||
if x == nil {
|
||||
return []byte{}
|
||||
}
|
||||
if buf == nil {
|
||||
buf = make([]byte, x.StableSize())
|
||||
}
|
||||
var offset int
|
||||
offset += proto.BytesMarshal(1, buf[offset:], x.PublicKey)
|
||||
offset += proto.RepeatedStringMarshal(2, buf[offset:], x.Addresses)
|
||||
for i := range x.Attributes {
|
||||
offset += proto.NestedStructureMarshal(3, buf[offset:], x.Attributes[i])
|
||||
}
|
||||
offset += proto.EnumMarshal(4, buf[offset:], int32(x.State))
|
||||
return buf
|
||||
}
|
||||
|
||||
// StableSize returns the size of x in protobuf format.
|
||||
//
|
||||
// Structures with the same field values have the same binary size.
|
||||
func (x *Netmap) StableSize() (size int) {
|
||||
size += proto.UInt64Size(1, x.Epoch)
|
||||
for i := range x.Nodes {
|
||||
size += proto.NestedStructureSize(2, x.Nodes[i])
|
||||
}
|
||||
return size
|
||||
}
|
||||
|
||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
||||
//
|
||||
// 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 *Netmap) StableMarshal(buf []byte) []byte {
|
||||
if x == nil {
|
||||
return []byte{}
|
||||
}
|
||||
if buf == nil {
|
||||
buf = make([]byte, x.StableSize())
|
||||
}
|
||||
var offset int
|
||||
offset += proto.UInt64Marshal(1, buf[offset:], x.Epoch)
|
||||
for i := range x.Nodes {
|
||||
offset += proto.NestedStructureMarshal(2, buf[offset:], x.Nodes[i])
|
||||
}
|
||||
return buf
|
||||
}
|
||||
|
||||
// StableSize returns the size of x in protobuf format.
|
||||
//
|
||||
// Structures with the same field values have the same binary size.
|
||||
func (x *ShardInfo) StableSize() (size int) {
|
||||
size += proto.BytesSize(1, x.Shard_ID)
|
||||
size += proto.StringSize(2, x.MetabasePath)
|
||||
size += proto.StringSize(3, x.BlobstorPath)
|
||||
size += proto.StringSize(4, x.WritecachePath)
|
||||
size += proto.EnumSize(5, int32(x.Mode))
|
||||
size += proto.UInt32Size(6, x.ErrorCount)
|
||||
return size
|
||||
}
|
||||
|
||||
// StableMarshal marshals x in protobuf binary format with stable field order.
|
||||
//
|
||||
// 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 *ShardInfo) StableMarshal(buf []byte) []byte {
|
||||
if x == nil {
|
||||
return []byte{}
|
||||
}
|
||||
if buf == nil {
|
||||
buf = make([]byte, x.StableSize())
|
||||
}
|
||||
var offset int
|
||||
offset += proto.BytesMarshal(1, buf[offset:], x.Shard_ID)
|
||||
offset += proto.StringMarshal(2, buf[offset:], x.MetabasePath)
|
||||
offset += proto.StringMarshal(3, buf[offset:], x.BlobstorPath)
|
||||
offset += proto.StringMarshal(4, buf[offset:], x.WritecachePath)
|
||||
offset += proto.EnumMarshal(5, buf[offset:], int32(x.Mode))
|
||||
offset += proto.UInt32Marshal(6, buf[offset:], x.ErrorCount)
|
||||
return buf
|
||||
}
|
Loading…
Reference in a new issue