[#172] Use protobuf v2 API for go

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-10-19 21:51:59 +03:00 committed by Alex Vanin
parent b681b28e33
commit 8351c78f58
28 changed files with 10089 additions and 32649 deletions

View file

@ -47,7 +47,7 @@ protoc:
echo "⇒ Processing $$f "; \
protoc \
--proto_path=.:./vendor:./vendor/github.com/nspcc-dev/neofs-api:/usr/local/include \
--gofast_out=plugins=grpc,paths=source_relative:. $$f; \
--go_out=plugins=grpc,paths=source_relative:. $$f; \
done
rm -rf vendor

7
go.mod
View file

@ -3,8 +3,7 @@ module github.com/nspcc-dev/neofs-api-go
go 1.14
require (
github.com/gogo/protobuf v1.1.1
github.com/golang/protobuf v1.4.2
github.com/golang/protobuf v1.4.3
github.com/google/uuid v1.1.1
github.com/mr-tron/base58 v1.1.2
github.com/nspcc-dev/hrw v1.0.9
@ -12,10 +11,8 @@ require (
github.com/nspcc-dev/neofs-crypto v0.3.0
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.6.1
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f // indirect
golang.org/x/text v0.3.2 // indirect
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a // indirect
google.golang.org/grpc v1.29.1
google.golang.org/protobuf v1.23.0
)
// Used for debug reasons

12
go.sum
View file

@ -84,8 +84,8 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
@ -244,15 +244,11 @@ golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f h1:gWF768j/LaZugp8dyS4UwsslYCYz9XgFxvlgsn0n9H8=
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180318012157-96caea41033d/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
@ -265,8 +261,6 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a h1:Ob5/580gVHBJZgXnff1cZDbG+xLtMVE5mDRTe+nIsX4=
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=

View file

@ -8,6 +8,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/util/proto/test"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
goproto "google.golang.org/protobuf/proto"
)
type SomeEnum int32
@ -437,7 +438,7 @@ func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongFiel
wire, err = c.stableMarshal(nil, wrongField)
require.NoError(t, err)
wireGen, err := tr.Marshal()
wireGen, err := goproto.Marshal(&tr)
require.NoError(t, err)
if !wrongField {
@ -448,7 +449,7 @@ func testMarshal(t *testing.T, c stablePrimitives, tr test.Primitives, wrongFiel
}
result := new(test.Primitives)
err = result.Unmarshal(wire)
err = goproto.Unmarshal(wire, result)
require.NoError(t, err)
return result
@ -588,7 +589,7 @@ func testRepMarshal(t *testing.T, c stableRepPrimitives, tr test.RepPrimitives,
wire, err = c.stableMarshal(nil, wrongField)
require.NoError(t, err)
wireGen, err := tr.Marshal()
wireGen, err := goproto.Marshal(&tr)
require.NoError(t, err)
if !wrongField {
@ -599,7 +600,7 @@ func testRepMarshal(t *testing.T, c stableRepPrimitives, tr test.RepPrimitives,
}
result := new(test.RepPrimitives)
err = result.Unmarshal(wire)
err = goproto.Unmarshal(wire, result)
require.NoError(t, err)
return result

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,26 +1,29 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.23.0
// protoc v3.13.0
// source: v2/accounting/grpc/types.proto
package accounting
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
// Standard floating point data type can't be used in NeoFS due to inexactness
// of the result when doing lots of small number operations. To solve the lost
@ -30,331 +33,141 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Specification](http://speleotrove.com/decimal/) for detailed problem
// description.
type Decimal struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Number in smallest Token fractions.
Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
// Precision value indicating how many smallest fractions can be in one
// integer.
Precision uint32 `protobuf:"varint,2,opt,name=precision,proto3" json:"precision,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Precision uint32 `protobuf:"varint,2,opt,name=precision,proto3" json:"precision,omitempty"`
}
func (m *Decimal) Reset() { *m = Decimal{} }
func (m *Decimal) String() string { return proto.CompactTextString(m) }
func (*Decimal) ProtoMessage() {}
func (x *Decimal) Reset() {
*x = Decimal{}
if protoimpl.UnsafeEnabled {
mi := &file_v2_accounting_grpc_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Decimal) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Decimal) ProtoMessage() {}
func (x *Decimal) ProtoReflect() protoreflect.Message {
mi := &file_v2_accounting_grpc_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Decimal.ProtoReflect.Descriptor instead.
func (*Decimal) Descriptor() ([]byte, []int) {
return fileDescriptor_86d8857937dfd0e8, []int{0}
}
func (m *Decimal) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Decimal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Decimal.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Decimal) XXX_Merge(src proto.Message) {
xxx_messageInfo_Decimal.Merge(m, src)
}
func (m *Decimal) XXX_Size() int {
return m.Size()
}
func (m *Decimal) XXX_DiscardUnknown() {
xxx_messageInfo_Decimal.DiscardUnknown(m)
return file_v2_accounting_grpc_types_proto_rawDescGZIP(), []int{0}
}
var xxx_messageInfo_Decimal proto.InternalMessageInfo
func (m *Decimal) GetValue() int64 {
if m != nil {
return m.Value
func (x *Decimal) GetValue() int64 {
if x != nil {
return x.Value
}
return 0
}
func (m *Decimal) GetPrecision() uint32 {
if m != nil {
return m.Precision
func (x *Decimal) GetPrecision() uint32 {
if x != nil {
return x.Precision
}
return 0
}
func init() {
proto.RegisterType((*Decimal)(nil), "neo.fs.v2.accounting.Decimal")
}
var File_v2_accounting_grpc_types_proto protoreflect.FileDescriptor
func init() { proto.RegisterFile("v2/accounting/grpc/types.proto", fileDescriptor_86d8857937dfd0e8) }
var fileDescriptor_86d8857937dfd0e8 = []byte{
// 203 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x33, 0xd2, 0x4f,
0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0xc9, 0xcc, 0x4b, 0xd7, 0x4f, 0x2f, 0x2a, 0x48, 0xd6, 0x2f,
0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xc9, 0x4b, 0xcd, 0xd7,
0x4b, 0x2b, 0xd6, 0x2b, 0x33, 0xd2, 0x43, 0x28, 0x53, 0xb2, 0xe5, 0x62, 0x77, 0x49, 0x4d, 0xce,
0xcc, 0x4d, 0xcc, 0x11, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x95, 0x60, 0x54, 0x60,
0xd4, 0x60, 0x0e, 0x82, 0x70, 0x84, 0x64, 0xb8, 0x38, 0x0b, 0x8a, 0x52, 0x93, 0x33, 0x8b, 0x33,
0xf3, 0xf3, 0x24, 0x98, 0x14, 0x18, 0x35, 0x78, 0x83, 0x10, 0x02, 0x4e, 0xd9, 0x27, 0x1e, 0xc9,
0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0xf6,
0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x79, 0xc5, 0x05, 0xc9, 0xc9,
0xba, 0x29, 0xa9, 0x65, 0xfa, 0x79, 0xa9, 0xf9, 0x69, 0xc5, 0xba, 0x89, 0x05, 0x99, 0xba, 0xe9,
0xf9, 0xfa, 0x98, 0x0e, 0xb5, 0x46, 0xf0, 0x57, 0x31, 0x89, 0xfb, 0xa5, 0xe6, 0xbb, 0x05, 0xeb,
0x39, 0x06, 0x78, 0x82, 0xdc, 0xea, 0x08, 0x97, 0x49, 0x62, 0x03, 0x7b, 0xc4, 0x18, 0x10, 0x00,
0x00, 0xff, 0xff, 0xcd, 0x8e, 0x26, 0xec, 0xea, 0x00, 0x00, 0x00,
}
func (m *Decimal) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Decimal) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Decimal) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if m.Precision != 0 {
i = encodeVarintTypes(dAtA, i, uint64(m.Precision))
i--
dAtA[i] = 0x10
}
if m.Value != 0 {
i = encodeVarintTypes(dAtA, i, uint64(m.Value))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
offset -= sovTypes(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *Decimal) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Value != 0 {
n += 1 + sovTypes(uint64(m.Value))
}
if m.Precision != 0 {
n += 1 + sovTypes(uint64(m.Precision))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovTypes(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTypes(x uint64) (n int) {
return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Decimal) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Decimal: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Decimal: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
}
m.Value = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Value |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Precision", wireType)
}
m.Precision = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Precision |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipTypes(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTypes(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthTypes
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTypes
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTypes
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
var file_v2_accounting_grpc_types_proto_rawDesc = []byte{
0x0a, 0x1e, 0x76, 0x32, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f,
0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x14, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x61, 0x63, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x3d, 0x0a, 0x07, 0x44, 0x65, 0x63, 0x69, 0x6d, 0x61,
0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x63, 0x69,
0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x70, 0x72, 0x65, 0x63,
0x69, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x5b, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65,
0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0xaa, 0x02, 0x17, 0x4e, 0x65, 0x6f, 0x46, 0x53,
0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x69,
0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
file_v2_accounting_grpc_types_proto_rawDescOnce sync.Once
file_v2_accounting_grpc_types_proto_rawDescData = file_v2_accounting_grpc_types_proto_rawDesc
)
func file_v2_accounting_grpc_types_proto_rawDescGZIP() []byte {
file_v2_accounting_grpc_types_proto_rawDescOnce.Do(func() {
file_v2_accounting_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_accounting_grpc_types_proto_rawDescData)
})
return file_v2_accounting_grpc_types_proto_rawDescData
}
var file_v2_accounting_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_v2_accounting_grpc_types_proto_goTypes = []interface{}{
(*Decimal)(nil), // 0: neo.fs.v2.accounting.Decimal
}
var file_v2_accounting_grpc_types_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_v2_accounting_grpc_types_proto_init() }
func file_v2_accounting_grpc_types_proto_init() {
if File_v2_accounting_grpc_types_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_v2_accounting_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Decimal); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_v2_accounting_grpc_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_v2_accounting_grpc_types_proto_goTypes,
DependencyIndexes: file_v2_accounting_grpc_types_proto_depIdxs,
MessageInfos: file_v2_accounting_grpc_types_proto_msgTypes,
}.Build()
File_v2_accounting_grpc_types_proto = out.File
file_v2_accounting_grpc_types_proto_rawDesc = nil
file_v2_accounting_grpc_types_proto_goTypes = nil
file_v2_accounting_grpc_types_proto_depIdxs = nil
}

View file

@ -7,6 +7,7 @@ import (
grpc "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/stretchr/testify/require"
goproto "google.golang.org/protobuf/proto"
)
func TestDecimal_StableMarshal(t *testing.T) {
@ -17,7 +18,7 @@ func TestDecimal_StableMarshal(t *testing.T) {
wire, err := decimalFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
decimalTo := accounting.DecimalFromGRPCMessage(transport)
@ -33,7 +34,7 @@ func TestBalanceRequestBody_StableMarshal(t *testing.T) {
wire, err := requestBodyFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
requestBodyTo := accounting.BalanceRequestBodyFromGRPCMessage(transport)
@ -49,7 +50,7 @@ func TestBalanceResponseBody_StableMarshal(t *testing.T) {
wire, err := responseBodyFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
responseBodyTo := accounting.BalanceResponseBodyFromGRPCMessage(transport)

2911
v2/acl/grpc/types.pb.go generated

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,7 @@ import (
grpc "github.com/nspcc-dev/neofs-api-go/v2/acl/grpc"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/stretchr/testify/require"
goproto "google.golang.org/protobuf/proto"
)
func generateTarget(u acl.Role, k int) *acl.Target {
@ -127,7 +128,7 @@ func TestHeaderFilter_StableMarshal(t *testing.T) {
wire, err := filterFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
filterTo := acl.HeaderFilterFromGRPCMessage(transport)
@ -149,7 +150,7 @@ func TestTargetInfo_StableMarshal(t *testing.T) {
wire, err := targetFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
targetTo := acl.TargetInfoFromGRPCMessage(transport)
@ -165,7 +166,7 @@ func TestRecord_StableMarshal(t *testing.T) {
wire, err := recordFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
recordTo := acl.RecordFromGRPCMessage(transport)
@ -195,7 +196,7 @@ func TestTable_StableMarshal(t *testing.T) {
wire, err := tableFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
tableTo := acl.TableFromGRPCMessage(transport)
@ -211,7 +212,7 @@ func TestTokenLifetime_StableMarshal(t *testing.T) {
wire, err := lifetimeFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
lifetimeTo := acl.TokenLifetimeFromGRPCMessage(transport)
@ -227,7 +228,7 @@ func TestBearerTokenBody_StableMarshal(t *testing.T) {
wire, err := bearerTokenBodyFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
bearerTokenBodyTo := acl.BearerTokenBodyFromGRPCMessage(transport)
@ -243,7 +244,7 @@ func TestBearerToken_StableMarshal(t *testing.T) {
wire, err := bearerTokenFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
bearerTokenTo := acl.BearerTokenFromGRPCMessage(transport)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -9,6 +9,7 @@ import (
grpc "github.com/nspcc-dev/neofs-api-go/v2/container/grpc"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/stretchr/testify/require"
goproto "google.golang.org/protobuf/proto"
)
func TestAttribute_StableMarshal(t *testing.T) {
@ -19,7 +20,7 @@ func TestAttribute_StableMarshal(t *testing.T) {
wire, err := attributeFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
attributeTo := container.AttributeFromGRPCMessage(transport)
@ -35,7 +36,7 @@ func TestContainer_StableMarshal(t *testing.T) {
wire, err := cnrFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
cnrTo := container.ContainerFromGRPCMessage(transport)
@ -51,7 +52,7 @@ func TestPutRequestBody_StableMarshal(t *testing.T) {
wire, err := requestFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
requestTo := container.PutRequestBodyFromGRPCMessage(transport)
@ -67,7 +68,7 @@ func TestPutResponseBody_StableMarshal(t *testing.T) {
wire, err := responseFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
responseTo := container.PutResponseBodyFromGRPCMessage(transport)
@ -83,7 +84,7 @@ func TestDeleteRequestBody_StableMarshal(t *testing.T) {
wire, err := requestFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
requestTo := container.DeleteRequestBodyFromGRPCMessage(transport)
@ -99,7 +100,7 @@ func TestDeleteResponseBody_StableMarshal(t *testing.T) {
wire, err := responseFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
responseTo := container.DeleteResponseBodyFromGRPCMessage(transport)
@ -115,7 +116,7 @@ func TestGetRequestBody_StableMarshal(t *testing.T) {
wire, err := requestFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
requestTo := container.GetRequestBodyFromGRPCMessage(transport)
@ -131,7 +132,7 @@ func TestGetResponseBody_StableMarshal(t *testing.T) {
wire, err := responseFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
responseTo := container.GetResponseBodyFromGRPCMessage(transport)
@ -147,7 +148,7 @@ func TestListRequestBody_StableMarshal(t *testing.T) {
wire, err := requestFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
requestTo := container.ListRequestBodyFromGRPCMessage(transport)
@ -163,7 +164,7 @@ func TestListResponseBody_StableMarshal(t *testing.T) {
wire, err := responseFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
responseTo := container.ListResponseBodyFromGRPCMessage(transport)
@ -179,7 +180,7 @@ func TestSetEACLRequestBody_StableMarshal(t *testing.T) {
wire, err := requestFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
requestTo := container.SetExtendedACLRequestBodyFromGRPCMessage(transport)
@ -195,7 +196,7 @@ func TestSetEACLResponseBody_StableMarshal(t *testing.T) {
wire, err := responseFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
responseTo := container.SetExtendedACLResponseBodyFromGRPCMessage(transport)
@ -211,7 +212,7 @@ func TestGetEACLRequestBody_StableMarshal(t *testing.T) {
wire, err := requestFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
requestTo := container.GetExtendedACLRequestBodyFromGRPCMessage(transport)
@ -227,7 +228,7 @@ func TestGetEACLResponseBody_StableMarshal(t *testing.T) {
wire, err := responseFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
responseTo := container.GetExtendedACLResponseBodyFromGRPCMessage(transport)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,7 @@ import (
grpc "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/stretchr/testify/require"
goproto "google.golang.org/protobuf/proto"
)
func TestAttribute_StableMarshal(t *testing.T) {
@ -18,7 +19,7 @@ func TestAttribute_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := netmap.AttributeFromGRPCMessage(transport)
@ -34,7 +35,7 @@ func TestNodeInfo_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := netmap.NodeInfoFromGRPCMessage(transport)
@ -50,7 +51,7 @@ func TestFilter_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := netmap.FilterFromGRPCMessage(transport)
@ -66,7 +67,7 @@ func TestSelector_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := netmap.SelectorFromGRPCMessage(transport)
@ -82,7 +83,7 @@ func TestReplica_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := netmap.ReplicaFromGRPCMessage(transport)
@ -98,7 +99,7 @@ func TestPlacementPolicy_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := netmap.PlacementPolicyFromGRPCMessage(transport)
@ -114,7 +115,7 @@ func TestLocalNodeInfoResponseBody_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := netmap.LocalNodeInfoResponseBodyFromGRPCMessage(transport)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@ package object
import (
"github.com/nspcc-dev/neofs-api-go/util/proto"
object "github.com/nspcc-dev/neofs-api-go/v2/object/grpc"
goproto "google.golang.org/protobuf/proto"
)
const (
@ -492,7 +493,7 @@ func (o *Object) StableUnmarshal(data []byte) error {
}
objGRPC := new(object.Object)
if err := objGRPC.Unmarshal(data); err != nil {
if err := goproto.Unmarshal(data, objGRPC); err != nil {
return err
}

View file

@ -10,6 +10,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/nspcc-dev/neofs-api-go/v2/session"
"github.com/stretchr/testify/require"
goproto "google.golang.org/protobuf/proto"
)
func TestShortHeader_StableMarshal(t *testing.T) {
@ -20,7 +21,7 @@ func TestShortHeader_StableMarshal(t *testing.T) {
wire, err := hdrFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
hdrTo := object.ShortHeaderFromGRPCMessage(transport)
@ -36,7 +37,7 @@ func TestAttribute_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.AttributeFromGRPCMessage(transport)
@ -55,7 +56,7 @@ func TestSplitHeader_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.SplitHeaderFromGRPCMessage(transport)
@ -77,7 +78,7 @@ func TestHeader_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.HeaderFromGRPCMessage(transport)
@ -93,7 +94,7 @@ func TestObject_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.ObjectFromGRPCMessage(transport)
@ -109,7 +110,7 @@ func TestGetRequestBody_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.GetRequestBodyFromGRPCMessage(transport)
@ -126,7 +127,7 @@ func TestGetResponseBody_StableMarshal(t *testing.T) {
wire, err := initFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.GetResponseBodyFromGRPCMessage(transport)
@ -137,7 +138,7 @@ func TestGetResponseBody_StableMarshal(t *testing.T) {
wire, err := chunkFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.GetResponseBodyFromGRPCMessage(transport)
@ -154,7 +155,7 @@ func TestPutRequestBody_StableMarshal(t *testing.T) {
wire, err := initFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.PutRequestBodyFromGRPCMessage(transport)
@ -165,7 +166,7 @@ func TestPutRequestBody_StableMarshal(t *testing.T) {
wire, err := chunkFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.PutRequestBodyFromGRPCMessage(transport)
@ -181,7 +182,7 @@ func TestPutRequestBody_StableSize(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.PutResponseBodyFromGRPCMessage(transport)
@ -197,7 +198,7 @@ func TestDeleteRequestBody_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.DeleteRequestBodyFromGRPCMessage(transport)
@ -213,7 +214,7 @@ func TestDeleteResponseBody_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.DeleteResponseBodyFromGRPCMessage(transport)
@ -229,7 +230,7 @@ func TestSplitHeaderFromGRPCMessage(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.HeadRequestBodyFromGRPCMessage(transport)
@ -246,7 +247,7 @@ func TestHeadResponseBody_StableMarshal(t *testing.T) {
wire, err := shortFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.HeadResponseBodyFromGRPCMessage(transport)
@ -257,7 +258,7 @@ func TestHeadResponseBody_StableMarshal(t *testing.T) {
wire, err := fullFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.HeadResponseBodyFromGRPCMessage(transport)
@ -273,7 +274,7 @@ func TestSearchRequestBody_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.SearchRequestBodyFromGRPCMessage(transport)
@ -289,7 +290,7 @@ func TestSearchResponseBody_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.SearchResponseBodyFromGRPCMessage(transport)
@ -305,7 +306,7 @@ func TestGetRangeRequestBody_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.GetRangeRequestBodyFromGRPCMessage(transport)
@ -321,7 +322,7 @@ func TestGetRangeResponseBody_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.GetRangeResponseBodyFromGRPCMessage(transport)
@ -337,7 +338,7 @@ func TestGetRangeHashRequestBody_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.GetRangeHashRequestBodyFromGRPCMessage(transport)
@ -353,7 +354,7 @@ func TestGetRangeHashResponseBody_StableMarshal(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := object.GetRangeHashResponseBodyFromGRPCMessage(transport)

2019
v2/refs/grpc/types.pb.go generated

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@ package refs
import (
"github.com/nspcc-dev/neofs-api-go/util/proto"
refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
goproto "google.golang.org/protobuf/proto"
)
const (
@ -147,7 +148,7 @@ func (a *Address) StableUnmarshal(data []byte) error {
}
addrGRPC := new(refs.Address)
if err := addrGRPC.Unmarshal(data); err != nil {
if err := goproto.Unmarshal(data, addrGRPC); err != nil {
return err
}

View file

@ -6,6 +6,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/v2/refs"
grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
"github.com/stretchr/testify/require"
goproto "google.golang.org/protobuf/proto"
)
func TestOwnerID_StableMarshal(t *testing.T) {
@ -18,7 +19,7 @@ func TestOwnerID_StableMarshal(t *testing.T) {
wire, err := ownerFrom.StableMarshal(nil)
require.NoError(t, err)
err = ownerTransport.Unmarshal(wire)
err = goproto.Unmarshal(wire, ownerTransport)
require.NoError(t, err)
ownerTo := refs.OwnerIDFromGRPCMessage(ownerTransport)
@ -36,7 +37,7 @@ func TestContainerID_StableMarshal(t *testing.T) {
wire, err := cnrFrom.StableMarshal(nil)
require.NoError(t, err)
err = cnrTransport.Unmarshal(wire)
err = goproto.Unmarshal(wire, cnrTransport)
require.NoError(t, err)
cnrTo := refs.ContainerIDFromGRPCMessage(cnrTransport)
@ -54,7 +55,7 @@ func TestObjectID_StableMarshal(t *testing.T) {
wire, err := objectIDFrom.StableMarshal(nil)
require.NoError(t, err)
err = objectIDTransport.Unmarshal(wire)
err = goproto.Unmarshal(wire, objectIDTransport)
require.NoError(t, err)
objectIDTo := refs.ObjectIDFromGRPCMessage(objectIDTransport)
@ -74,7 +75,7 @@ func TestAddress_StableMarshal(t *testing.T) {
wire, err := addressFrom.StableMarshal(nil)
require.NoError(t, err)
err = addressTransport.Unmarshal(wire)
err = goproto.Unmarshal(wire, addressTransport)
require.NoError(t, err)
addressTo := refs.AddressFromGRPCMessage(addressTransport)
@ -93,7 +94,7 @@ func TestChecksum_StableMarshal(t *testing.T) {
wire, err := checksumFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
checksumTo := refs.ChecksumFromGRPCMessage(transport)
@ -109,7 +110,7 @@ func TestSignature_StableMarshal(t *testing.T) {
wire, err := signatureFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
signatureTo := refs.SignatureFromGRPCMessage(transport)
@ -125,7 +126,7 @@ func TestVersion_StableMarshal(t *testing.T) {
wire, err := versionFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
versionTo := refs.VersionFromGRPCMessage(transport)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -9,6 +9,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/v2/session"
grpc "github.com/nspcc-dev/neofs-api-go/v2/session/grpc"
"github.com/stretchr/testify/require"
goproto "google.golang.org/protobuf/proto"
)
func TestCreateRequestBody_StableMarshal(t *testing.T) {
@ -19,7 +20,7 @@ func TestCreateRequestBody_StableMarshal(t *testing.T) {
wire, err := requestFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
requestTo := session.CreateRequestBodyFromGRPCMessage(transport)
@ -35,7 +36,7 @@ func TestCreateResponseBody_StableMarshal(t *testing.T) {
wire, err := responseFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
responseTo := session.CreateResponseBodyFromGRPCMessage(transport)
@ -51,7 +52,7 @@ func TestXHeader_StableMarshal(t *testing.T) {
wire, err := xheaderFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
xheaderTo := session.XHeaderFromGRPCMessage(transport)
@ -67,7 +68,7 @@ func TestTokenLifetime_StableMarshal(t *testing.T) {
wire, err := lifetimeFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
lifetimeTo := session.TokenLifetimeFromGRPCMessage(transport)
@ -83,7 +84,7 @@ func TestObjectSessionContext_StableMarshal(t *testing.T) {
wire, err := objectCtxFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
objectCtxTo := session.ObjectSessionContextFromGRPCMessage(transport)
@ -99,7 +100,7 @@ func TestSessionTokenBody_StableMarshal(t *testing.T) {
wire, err := sessionTokenBodyFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
sessionTokenBodyTo := session.SessionTokenBodyFromGRPCMessage(transport)
@ -115,7 +116,7 @@ func TestSessionToken_StableMarshal(t *testing.T) {
wire, err := sessionTokenFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
sessionTokenTo := session.SessionTokenFromGRPCMessage(transport)
@ -133,7 +134,7 @@ func TestRequestMetaHeader_StableMarshal(t *testing.T) {
wire, err := metaHeaderFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
metaHeaderTo := session.RequestMetaHeaderFromGRPCMessage(transport)
@ -151,7 +152,7 @@ func TestRequestVerificationHeader_StableMarshal(t *testing.T) {
wire, err := verifHeaderFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
verifHeaderTo := session.RequestVerificationHeaderFromGRPCMessage(transport)
@ -169,7 +170,7 @@ func TestResponseMetaHeader_StableMarshal(t *testing.T) {
wire, err := metaHeaderFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
metaHeaderTo := session.ResponseMetaHeaderFromGRPCMessage(transport)
@ -187,7 +188,7 @@ func TestResponseVerificationHeader_StableMarshal(t *testing.T) {
wire, err := verifHeaderFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
verifHeaderTo := session.ResponseVerificationHeaderFromGRPCMessage(transport)

View file

@ -1,33 +1,40 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.23.0
// protoc v3.13.0
// source: v2/storagegroup/grpc/types.proto
package storagegroup
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
grpc "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
io "io"
math "math"
math_bits "math/bits"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
// StorageGroup keeps verification information for Data Audit sessions. Objects
// that require payed storage guaranties are gathered in `StorageGroups` with
// additional information used for proof of storage. `StorageGroup` only
// contains objects from the same container.
type StorageGroup struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Total size of the payloads of objects in the storage group
ValidationDataSize uint64 `protobuf:"varint,1,opt,name=validation_data_size,json=validationDataSize,proto3" json:"validation_data_size,omitempty"`
// Homomorphic hash from the concatenation of the payloads of the storage
@ -37,454 +44,164 @@ type StorageGroup struct {
// Last NeoFS epoch number of the storage group lifetime
ExpirationEpoch uint64 `protobuf:"varint,3,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"`
// Strictly ordered list of storage group member objects
Members []*grpc.ObjectID `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Members []*grpc.ObjectID `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"`
}
func (m *StorageGroup) Reset() { *m = StorageGroup{} }
func (m *StorageGroup) String() string { return proto.CompactTextString(m) }
func (*StorageGroup) ProtoMessage() {}
func (x *StorageGroup) Reset() {
*x = StorageGroup{}
if protoimpl.UnsafeEnabled {
mi := &file_v2_storagegroup_grpc_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StorageGroup) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StorageGroup) ProtoMessage() {}
func (x *StorageGroup) ProtoReflect() protoreflect.Message {
mi := &file_v2_storagegroup_grpc_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StorageGroup.ProtoReflect.Descriptor instead.
func (*StorageGroup) Descriptor() ([]byte, []int) {
return fileDescriptor_f1685cc94b670845, []int{0}
}
func (m *StorageGroup) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *StorageGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_StorageGroup.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *StorageGroup) XXX_Merge(src proto.Message) {
xxx_messageInfo_StorageGroup.Merge(m, src)
}
func (m *StorageGroup) XXX_Size() int {
return m.Size()
}
func (m *StorageGroup) XXX_DiscardUnknown() {
xxx_messageInfo_StorageGroup.DiscardUnknown(m)
return file_v2_storagegroup_grpc_types_proto_rawDescGZIP(), []int{0}
}
var xxx_messageInfo_StorageGroup proto.InternalMessageInfo
func (m *StorageGroup) GetValidationDataSize() uint64 {
if m != nil {
return m.ValidationDataSize
func (x *StorageGroup) GetValidationDataSize() uint64 {
if x != nil {
return x.ValidationDataSize
}
return 0
}
func (m *StorageGroup) GetValidationHash() *grpc.Checksum {
if m != nil {
return m.ValidationHash
func (x *StorageGroup) GetValidationHash() *grpc.Checksum {
if x != nil {
return x.ValidationHash
}
return nil
}
func (m *StorageGroup) GetExpirationEpoch() uint64 {
if m != nil {
return m.ExpirationEpoch
func (x *StorageGroup) GetExpirationEpoch() uint64 {
if x != nil {
return x.ExpirationEpoch
}
return 0
}
func (m *StorageGroup) GetMembers() []*grpc.ObjectID {
if m != nil {
return m.Members
func (x *StorageGroup) GetMembers() []*grpc.ObjectID {
if x != nil {
return x.Members
}
return nil
}
func init() {
proto.RegisterType((*StorageGroup)(nil), "neo.fs.v2.storagegroup.StorageGroup")
}
var File_v2_storagegroup_grpc_types_proto protoreflect.FileDescriptor
func init() { proto.RegisterFile("v2/storagegroup/grpc/types.proto", fileDescriptor_f1685cc94b670845) }
var fileDescriptor_f1685cc94b670845 = []byte{
// 306 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x3f, 0x4e, 0xc3, 0x30,
0x18, 0xc5, 0x71, 0x5b, 0x81, 0x14, 0x10, 0x45, 0x11, 0x42, 0x86, 0x21, 0x8a, 0x98, 0xca, 0x50,
0x1b, 0x85, 0x91, 0xa9, 0xb4, 0xfc, 0xe9, 0x02, 0xa8, 0xdd, 0x58, 0x2a, 0xc7, 0xfd, 0x1a, 0x1b,
0x48, 0x6c, 0x6c, 0x37, 0x82, 0x9e, 0x84, 0x33, 0x70, 0x12, 0x46, 0x8e, 0x80, 0xc2, 0x45, 0x50,
0x5a, 0xa1, 0x44, 0xa2, 0xeb, 0xf3, 0xef, 0xf9, 0xf7, 0xe9, 0x79, 0x61, 0x1e, 0x51, 0xeb, 0x94,
0x61, 0x09, 0x24, 0x46, 0xcd, 0x35, 0x4d, 0x8c, 0xe6, 0xd4, 0xbd, 0x69, 0xb0, 0x44, 0x1b, 0xe5,
0x94, 0x7f, 0x90, 0x81, 0x22, 0x33, 0x4b, 0xf2, 0x88, 0xd4, 0xc1, 0x23, 0x9c, 0x47, 0xd4, 0xc0,
0xcc, 0xfe, 0x6b, 0x1c, 0x17, 0xc8, 0xdb, 0x19, 0xaf, 0xd0, 0xeb, 0x12, 0xf5, 0x4f, 0xbd, 0xfd,
0x9c, 0x3d, 0xcb, 0x29, 0x73, 0x52, 0x65, 0x93, 0x29, 0x73, 0x6c, 0x62, 0xe5, 0x02, 0x30, 0x0a,
0x51, 0xa7, 0x35, 0xf2, 0xab, 0xb7, 0x01, 0x73, 0x6c, 0x2c, 0x17, 0xe0, 0xf7, 0xbc, 0x76, 0xad,
0x21, 0x98, 0x15, 0xb8, 0x11, 0xa2, 0xce, 0x76, 0x84, 0x49, 0x75, 0x4e, 0x69, 0x27, 0x7d, 0x01,
0xfc, 0xc9, 0xce, 0xd3, 0xd1, 0x6e, 0x55, 0xb8, 0x61, 0x56, 0xf8, 0x27, 0xde, 0x1e, 0xbc, 0x6a,
0x69, 0x56, 0x5f, 0x80, 0x56, 0x5c, 0xe0, 0xe6, 0x52, 0xd8, 0xae, 0xf2, 0xcb, 0x32, 0xf6, 0x23,
0x6f, 0x2b, 0x85, 0x34, 0x06, 0x63, 0x71, 0x2b, 0x6c, 0xae, 0xb3, 0xdc, 0xc5, 0x8f, 0xc0, 0xdd,
0x70, 0x30, 0xfa, 0x03, 0x2f, 0x5e, 0x3e, 0x8b, 0x00, 0x7d, 0x15, 0x01, 0xfa, 0x2e, 0x02, 0xf4,
0xfe, 0x13, 0x6c, 0x3c, 0xf4, 0x13, 0xe9, 0xc4, 0x3c, 0x26, 0x5c, 0xa5, 0x34, 0xb3, 0x9a, 0xf3,
0xee, 0x14, 0x72, 0x9a, 0x81, 0x9a, 0xd9, 0x2e, 0xd3, 0xb2, 0x9b, 0x28, 0xba, 0x6e, 0xec, 0xf3,
0x7a, 0xf2, 0xd1, 0x38, 0xbc, 0x05, 0x75, 0x35, 0x26, 0xbd, 0xfb, 0x61, 0x29, 0xaf, 0xcf, 0x18,
0x6f, 0x2e, 0xe7, 0x3d, 0xfb, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x31, 0x2e, 0xd2, 0x63, 0xb4, 0x01,
0x00, 0x00,
}
func (m *StorageGroup) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *StorageGroup) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *StorageGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Members) > 0 {
for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTypes(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
}
}
if m.ExpirationEpoch != 0 {
i = encodeVarintTypes(dAtA, i, uint64(m.ExpirationEpoch))
i--
dAtA[i] = 0x18
}
if m.ValidationHash != nil {
{
size, err := m.ValidationHash.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTypes(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if m.ValidationDataSize != 0 {
i = encodeVarintTypes(dAtA, i, uint64(m.ValidationDataSize))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
offset -= sovTypes(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *StorageGroup) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ValidationDataSize != 0 {
n += 1 + sovTypes(uint64(m.ValidationDataSize))
}
if m.ValidationHash != nil {
l = m.ValidationHash.Size()
n += 1 + l + sovTypes(uint64(l))
}
if m.ExpirationEpoch != 0 {
n += 1 + sovTypes(uint64(m.ExpirationEpoch))
}
if len(m.Members) > 0 {
for _, e := range m.Members {
l = e.Size()
n += 1 + l + sovTypes(uint64(l))
}
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovTypes(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTypes(x uint64) (n int) {
return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *StorageGroup) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: StorageGroup: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: StorageGroup: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidationDataSize", wireType)
}
m.ValidationDataSize = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ValidationDataSize |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidationHash", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.ValidationHash == nil {
m.ValidationHash = &grpc.Checksum{}
}
if err := m.ValidationHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ExpirationEpoch", wireType)
}
m.ExpirationEpoch = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ExpirationEpoch |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Members", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Members = append(m.Members, &grpc.ObjectID{})
if err := m.Members[len(m.Members)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTypes(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTypes(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthTypes
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTypes
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTypes
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
var file_v2_storagegroup_grpc_types_proto_rawDesc = []byte{
0x0a, 0x20, 0x76, 0x32, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75,
0x70, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x16, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x73, 0x74,
0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x1a, 0x18, 0x76, 0x32, 0x2f, 0x72,
0x65, 0x66, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe2, 0x01, 0x0a, 0x0c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65,
0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x30, 0x0a, 0x14, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x04, 0x52, 0x12, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44,
0x61, 0x74, 0x61, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x41, 0x0a, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x72, 0x65, 0x66,
0x73, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x52, 0x0e, 0x76, 0x61, 0x6c, 0x69,
0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x78,
0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x03,
0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x45, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73,
0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x6f, 0x2e, 0x66, 0x73, 0x2e,
0x76, 0x32, 0x2e, 0x72, 0x65, 0x66, 0x73, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x44,
0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x42, 0x61, 0x5a, 0x43, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65,
0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76,
0x32, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2f, 0x67,
0x72, 0x70, 0x63, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x70,
0xaa, 0x02, 0x19, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e,
0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
}
var (
ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
file_v2_storagegroup_grpc_types_proto_rawDescOnce sync.Once
file_v2_storagegroup_grpc_types_proto_rawDescData = file_v2_storagegroup_grpc_types_proto_rawDesc
)
func file_v2_storagegroup_grpc_types_proto_rawDescGZIP() []byte {
file_v2_storagegroup_grpc_types_proto_rawDescOnce.Do(func() {
file_v2_storagegroup_grpc_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_v2_storagegroup_grpc_types_proto_rawDescData)
})
return file_v2_storagegroup_grpc_types_proto_rawDescData
}
var file_v2_storagegroup_grpc_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_v2_storagegroup_grpc_types_proto_goTypes = []interface{}{
(*StorageGroup)(nil), // 0: neo.fs.v2.storagegroup.StorageGroup
(*grpc.Checksum)(nil), // 1: neo.fs.v2.refs.Checksum
(*grpc.ObjectID)(nil), // 2: neo.fs.v2.refs.ObjectID
}
var file_v2_storagegroup_grpc_types_proto_depIdxs = []int32{
1, // 0: neo.fs.v2.storagegroup.StorageGroup.validation_hash:type_name -> neo.fs.v2.refs.Checksum
2, // 1: neo.fs.v2.storagegroup.StorageGroup.members:type_name -> neo.fs.v2.refs.ObjectID
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_v2_storagegroup_grpc_types_proto_init() }
func file_v2_storagegroup_grpc_types_proto_init() {
if File_v2_storagegroup_grpc_types_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_v2_storagegroup_grpc_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StorageGroup); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_v2_storagegroup_grpc_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_v2_storagegroup_grpc_types_proto_goTypes,
DependencyIndexes: file_v2_storagegroup_grpc_types_proto_depIdxs,
MessageInfos: file_v2_storagegroup_grpc_types_proto_msgTypes,
}.Build()
File_v2_storagegroup_grpc_types_proto = out.File
file_v2_storagegroup_grpc_types_proto_rawDesc = nil
file_v2_storagegroup_grpc_types_proto_goTypes = nil
file_v2_storagegroup_grpc_types_proto_depIdxs = nil
}

View file

@ -7,6 +7,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/v2/storagegroup"
grpc "github.com/nspcc-dev/neofs-api-go/v2/storagegroup/grpc"
"github.com/stretchr/testify/require"
goproto "google.golang.org/protobuf/proto"
)
func TestStorageGroup_StableMarshal(t *testing.T) {
@ -28,7 +29,7 @@ func TestStorageGroup_StableMarshal(t *testing.T) {
wire, err := storageGroupFrom.StableMarshal(nil)
require.NoError(t, err)
err = transport.Unmarshal(wire)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
storageGroupTo := storagegroup.StorageGroupFromGRPCMessage(transport)