diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index de59f36..d846055 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -38,4 +38,6 @@ jobs: run: go test -coverprofile=coverage.txt -covermode=atomic ./... - name: Codecov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: bash <(curl -s https://codecov.io/bash) diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e4b71c8 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog +This is the changelog for NeoFS Proto + +## [0.2.0] - 2019-11-21 + +### Added +- Container not found error +- GitHub Actions as CI and Codecov +- Auto-generated proto documentation +- RequestMetaHeader to all RPC requests +- RequestVerificationHeader to all RPC requests + +### Changed +- Moved TTL and Epoch fields to RequestMetaHeader +- Renamed Version in object.SearchRequest to QueryVersion +- Removed SetTTL, GetTTL, SetEpoch, GetEpoch from all RPC requests + +## 0.1.0 - 2019-11-18 + +Initial public release + +[0.2.0]: https://github.com/nspcc-dev/neofs-proto/compare/v0.1.0...v0.2.0 diff --git a/Makefile b/Makefile index 64b0939..9609923 100644 --- a/Makefile +++ b/Makefile @@ -33,5 +33,5 @@ protoc: echo "${B}${G}⇒ Processing $$f ${R}"; \ protoc \ --proto_path=.:./vendor:/usr/local/include \ - --gofast_out=plugins=grpc,paths=source_relative:. $$f; \ + --gofast_out=plugins=grpc,paths=source_relative:. $$f; \ done diff --git a/accounting/service.go b/accounting/service.go index df74e58..ac1ceb5 100644 --- a/accounting/service.go +++ b/accounting/service.go @@ -31,9 +31,6 @@ const ( ErrEmptyParentAddress = internal.Error("empty parent address") ) -// SetTTL sets ttl to BalanceRequest to satisfy TTLRequest interface. -func (m BalanceRequest) SetTTL(v uint32) { m.TTL = v } - // SumFunds goes through all accounts and sums up active funds. func SumFunds(accounts []*Account) (res *decimal.Decimal) { res = decimal.Zero.Copy() diff --git a/accounting/service.pb.go b/accounting/service.pb.go index bc31ce1..7a8a086 100644 --- a/accounting/service.pb.go +++ b/accounting/service.pb.go @@ -9,6 +9,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" decimal "github.com/nspcc-dev/neofs-proto/decimal" + service "github.com/nspcc-dev/neofs-proto/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -31,12 +32,13 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type BalanceRequest struct { // OwnerID is a wallet address OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *BalanceRequest) Reset() { *m = BalanceRequest{} } @@ -68,13 +70,6 @@ func (m *BalanceRequest) XXX_DiscardUnknown() { var xxx_messageInfo_BalanceRequest proto.InternalMessageInfo -func (m *BalanceRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type BalanceResponse struct { // Balance contains current account balance state Balance *decimal.Decimal `protobuf:"bytes,1,opt,name=Balance,proto3" json:"Balance,omitempty"` @@ -137,27 +132,31 @@ func init() { func init() { proto.RegisterFile("accounting/service.proto", fileDescriptor_7f9514b8f1d4c7fe) } var fileDescriptor_7f9514b8f1d4c7fe = []byte{ - // 311 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x48, 0x4c, 0x4e, 0xce, - 0x2f, 0xcd, 0x2b, 0xc9, 0xcc, 0x4b, 0xd7, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, - 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0xc8, 0x48, 0x89, 0xa6, 0xa4, 0x26, 0x67, 0xe6, 0x26, - 0xe6, 0xe8, 0x43, 0x69, 0x88, 0x12, 0x29, 0x31, 0x24, 0xcd, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x50, - 0x71, 0xdd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xf4, 0xfc, 0xf4, - 0x7c, 0x7d, 0xb0, 0x70, 0x52, 0x69, 0x1a, 0x98, 0x07, 0xe6, 0x80, 0x59, 0x10, 0xe5, 0x4a, 0xbe, - 0x5c, 0x7c, 0x4e, 0x89, 0x39, 0x89, 0x79, 0xc9, 0xa9, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, - 0x42, 0x9a, 0x5c, 0xec, 0xfe, 0xe5, 0x79, 0xa9, 0x45, 0x9e, 0x2e, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, - 0x3c, 0x4e, 0xfc, 0x27, 0xee, 0xc9, 0x33, 0xdc, 0xba, 0x27, 0x0f, 0x13, 0x0e, 0x82, 0x31, 0x84, - 0x04, 0xb8, 0x98, 0x43, 0x42, 0x7c, 0x24, 0x98, 0x14, 0x18, 0x35, 0x78, 0x83, 0x40, 0x4c, 0xa5, - 0x32, 0x2e, 0x7e, 0xb8, 0x71, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x42, 0x5a, 0x5c, 0xec, 0x50, - 0x21, 0xb0, 0x79, 0xdc, 0x46, 0x02, 0x7a, 0x30, 0x9f, 0xb8, 0x40, 0xe8, 0x20, 0x98, 0x02, 0x21, - 0x73, 0x2e, 0x1e, 0x9f, 0xfc, 0xe4, 0x6c, 0x47, 0x88, 0xd7, 0x8a, 0x25, 0x98, 0x14, 0x98, 0x35, - 0xb8, 0x8d, 0x84, 0xf5, 0x10, 0x7e, 0xd5, 0x83, 0xca, 0x05, 0xa1, 0x28, 0x34, 0x0a, 0xe0, 0xe2, - 0x72, 0x84, 0xab, 0x11, 0x72, 0x82, 0x5b, 0x29, 0x24, 0x85, 0xac, 0x17, 0xd5, 0xa7, 0x52, 0xd2, - 0x58, 0xe5, 0x20, 0xce, 0x76, 0x72, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, - 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x1b, 0x29, 0x74, - 0xf3, 0x8a, 0x0b, 0x92, 0x93, 0x75, 0x53, 0x52, 0xcb, 0xf4, 0xf3, 0x52, 0xf3, 0xd3, 0x8a, 0x75, - 0x21, 0x61, 0x8b, 0x30, 0x32, 0x89, 0x0d, 0x2c, 0x62, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x0c, - 0x45, 0x3c, 0x0a, 0xe8, 0x01, 0x00, 0x00, + // 381 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xbd, 0x6e, 0xdb, 0x30, + 0x14, 0x85, 0xcd, 0xb6, 0xb0, 0x0b, 0xda, 0xa8, 0x0b, 0xf6, 0x07, 0x82, 0x0a, 0xc8, 0x86, 0x27, + 0xb7, 0x85, 0x25, 0x40, 0x1d, 0xda, 0xd5, 0x82, 0x87, 0x16, 0x68, 0xd1, 0x40, 0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xbd, 0xe9, 0xa1, 0x50, 0x3b, 0xc8, 0x04, 0x37, 0x4f, 0xf5, 0x2b, 0x2d, 0xa6, + 0xbd, 0x83, 0xa7, 0x5e, 0xad, 0x26, 0x8c, 0xaa, 0x44, 0xf0, 0x67, 0x3d, 0x8c, 0x77, 0x50, 0xe0, + 0xee, 0x6e, 0x78, 0x99, 0x0a, 0x2e, 0x81, 0x7c, 0xc3, 0x2d, 0x83, 0xf4, 0xf4, 0x6d, 0xff, 0xbd, + 0x5b, 0x07, 0x37, 0xa9, 0xd6, 0xb0, 0x2e, 0x20, 0x3f, 0x71, 0xe7, 0xaf, 0x60, 0x17, 0xe3, 0x2a, + 0x49, 0x69, 0xbd, 0xea, 0xbf, 0x1e, 0xb6, 0xfd, 0x0f, 0xee, 0x3e, 0x5a, 0xd7, 0x68, 0xe1, 0x51, + 0xa1, 0x7f, 0x82, 0xf1, 0x78, 0x57, 0x43, 0x82, 0xdd, 0x95, 0xc4, 0x3e, 0xf4, 0x1e, 0xe7, 0x6a, + 0x7f, 0x79, 0x51, 0xab, 0xc6, 0x0e, 0xc6, 0xab, 0xd2, 0x41, 0xeb, 0xd2, 0x41, 0xb7, 0xa5, 0x83, + 0xee, 0x4b, 0x07, 0x5d, 0x3f, 0x38, 0x8d, 0xb3, 0xef, 0x07, 0x9f, 0xc9, 0x65, 0xca, 0xd8, 0x68, + 0x0a, 0x85, 0xc7, 0x41, 0xcc, 0xe4, 0xa8, 0xfa, 0xca, 0x7d, 0xcb, 0xa8, 0xa9, 0xc9, 0x8f, 0xc7, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xf9, 0xca, 0x86, 0x87, 0x81, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -266,11 +265,30 @@ func (m *BalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x10 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 { size := m.OwnerID.Size() i -= size @@ -356,9 +374,10 @@ func (m *BalanceRequest) Size() (n int) { _ = l l = m.OwnerID.Size() n += 1 + l + sovService(uint64(l)) - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -455,11 +474,11 @@ func (m *BalanceRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -469,11 +488,58 @@ func (m *BalanceRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/accounting/service.proto b/accounting/service.proto index 9cfdb0f..f2696c4 100644 --- a/accounting/service.proto +++ b/accounting/service.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package accounting; option go_package = "github.com/nspcc-dev/neofs-proto/accounting"; +import "service/meta.proto"; +import "service/verify.proto"; import "decimal/decimal.proto"; import "accounting/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -17,10 +19,11 @@ service Accounting { message BalanceRequest { // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 2; + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message BalanceResponse { diff --git a/accounting/withdraw.go b/accounting/withdraw.go index 3cd2766..0a8cf90 100644 --- a/accounting/withdraw.go +++ b/accounting/withdraw.go @@ -11,18 +11,6 @@ type ( MessageID = refs.MessageID ) -// SetTTL sets ttl to GetRequest to satisfy TTLRequest interface. -func (m *GetRequest) SetTTL(v uint32) { m.TTL = v } - -// SetTTL sets ttl to PutRequest to satisfy TTLRequest interface. -func (m *PutRequest) SetTTL(v uint32) { m.TTL = v } - -// SetTTL sets ttl to ListRequest to satisfy TTLRequest interface. -func (m *ListRequest) SetTTL(v uint32) { m.TTL = v } - -// SetTTL sets ttl to DeleteRequest to satisfy TTLRequest interface. -func (m *DeleteRequest) SetTTL(v uint32) { m.TTL = v } - // SetSignature sets signature to PutRequest to satisfy SignedRequest interface. func (m *PutRequest) SetSignature(v []byte) { m.Signature = v } diff --git a/accounting/withdraw.pb.go b/accounting/withdraw.pb.go index f0e78aa..a2116c0 100644 --- a/accounting/withdraw.pb.go +++ b/accounting/withdraw.pb.go @@ -9,6 +9,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" decimal "github.com/nspcc-dev/neofs-proto/decimal" + service "github.com/nspcc-dev/neofs-proto/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -99,12 +100,13 @@ type GetRequest struct { ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` // OwnerID is a wallet address OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRequest) Reset() { *m = GetRequest{} } @@ -136,13 +138,6 @@ func (m *GetRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetRequest proto.InternalMessageInfo -func (m *GetRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type GetResponse struct { // Withdraw is cheque with meta information Withdraw *Item `protobuf:"bytes,1,opt,name=Withdraw,proto3" json:"Withdraw,omitempty"` @@ -198,12 +193,13 @@ type PutRequest struct { MessageID MessageID `protobuf:"bytes,4,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` // Signature is a signature of the sent request Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,6,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest) Reset() { *m = PutRequest{} } @@ -256,13 +252,6 @@ func (m *PutRequest) GetSignature() []byte { return nil } -func (m *PutRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type PutResponse struct { // ID is cheque identifier ID ChequeID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=ChequeID" json:"ID"` @@ -303,12 +292,13 @@ var xxx_messageInfo_PutResponse proto.InternalMessageInfo type ListRequest struct { // OwnerID is a wallet address OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ListRequest) Reset() { *m = ListRequest{} } @@ -340,13 +330,6 @@ func (m *ListRequest) XXX_DiscardUnknown() { var xxx_messageInfo_ListRequest proto.InternalMessageInfo -func (m *ListRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type ListResponse struct { // Items is a set of cheques with meta information Items []*Item `protobuf:"bytes,1,rep,name=Items,proto3" json:"Items,omitempty"` @@ -400,12 +383,13 @@ type DeleteRequest struct { MessageID MessageID `protobuf:"bytes,3,opt,name=MessageID,proto3,customtype=MessageID" json:"MessageID"` // Signature is a signature of the sent request Signature []byte `protobuf:"bytes,4,opt,name=Signature,proto3" json:"Signature,omitempty"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } @@ -444,13 +428,6 @@ func (m *DeleteRequest) GetSignature() []byte { return nil } -func (m *DeleteRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - // DeleteResponse is empty type DeleteResponse struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -502,42 +479,46 @@ func init() { func init() { proto.RegisterFile("accounting/withdraw.proto", fileDescriptor_b3a38a4dc2575267) } var fileDescriptor_b3a38a4dc2575267 = []byte{ - // 550 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xc7, 0xbb, 0xb6, 0xe3, 0xb6, 0x93, 0x14, 0xc2, 0x4a, 0x14, 0xd7, 0x42, 0xae, 0xe5, 0x03, - 0x0a, 0x82, 0xc4, 0x52, 0x91, 0x22, 0x21, 0x0e, 0xa8, 0xc1, 0x52, 0x31, 0x2a, 0x22, 0x32, 0x95, - 0x90, 0xb8, 0x39, 0xce, 0xd6, 0xb1, 0x48, 0xec, 0x10, 0xaf, 0x89, 0x78, 0x13, 0xde, 0x82, 0x27, - 0xe0, 0xde, 0x23, 0x47, 0xd4, 0x43, 0x85, 0xc2, 0x3b, 0x70, 0x46, 0x5e, 0xaf, 0xbb,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, 0xff, 0x8a, 0x7e, 0xeb, 0x82, 0x9f, 0xe3, - 0xeb, 0x83, 0x3c, 0xcc, 0x7e, 0xda, 0x27, 0x2e, 0x6e, 0x7d, 0x5f, 0x55, 0xf4, 0x87, 0xa0, 0xe4, - 0x32, 0xe0, 0x5a, 0x42, 0x45, 0x64, 0x5d, 0xbb, 0x18, 0xe0, 0x5b, 0x1f, 0x83, 0x5a, 0x4c, 0x82, - 0x77, 0xaa, 0x39, 0x35, 0x71, 0x74, 0xfd, 0xb2, 0x50, 0x71, 0xc0, 0x60, 0xff, 0x64, 0x65, 0xa0, - 0xcf, 0x2b, 0x03, 0x7d, 0x59, 0x19, 0xe8, 0xeb, 0xca, 0x40, 0x1f, 0xbe, 0x19, 0x6b, 0xaf, 0xef, - 0x55, 0x5e, 0xbf, 0x38, 0x9d, 0x07, 0x41, 0x77, 0x4c, 0xde, 0xd9, 0x31, 0x49, 0x8e, 0xd3, 0x6e, - 0xf1, 0xf6, 0x89, 0x13, 0x47, 0x2a, 0xf3, 0x3c, 0xf8, 0x11, 0x00, 0x00, 0xff, 0xff, 0xd9, 0xcf, - 0xde, 0x66, 0x71, 0x05, 0x00, 0x00, + // 615 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x41, 0x6b, 0xd4, 0x40, + 0x14, 0xee, 0x24, 0xe9, 0xb6, 0x7d, 0x5b, 0xb5, 0x0e, 0x5a, 0xd3, 0x20, 0xdb, 0x25, 0x07, 0x59, + 0xd1, 0x26, 0x50, 0xa1, 0x28, 0x1e, 0xa4, 0x6b, 0xa0, 0x0d, 0x58, 0x2c, 0x11, 0x14, 0xbc, 0x65, + 0xb3, 0xaf, 0xd9, 0x40, 0x37, 0x59, 0x93, 0xc9, 0x2e, 0xfd, 0x27, 0xfe, 0x07, 0x0f, 0x5e, 0xfd, + 0x09, 0x7b, 0xec, 0x51, 0x3d, 0x2c, 0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 0x31, 0x55, 0x69, 0x92, + 0x96, 0xe2, 0x88, 0x1d, 0x55, 0x61, 0xe9, 0xd0, 0x3d, 0x39, 0x8e, 0xdc, 0xae, 0xba, 0x98, 0x5d, + 0xe6, 0x14, 0x5b, 0xfd, 0x0b, 0x01, 0xd8, 0x43, 0xe6, 0x64, 0x9d, 0x25, 0xec, 0xef, 0xf6, 0xfd, + 0x18, 0x94, 0x03, 0x64, 0xae, 0xda, 0xe1, 0x5d, 0x6b, 0x86, 0x20, 0xde, 0x10, 0x97, 0x65, 0xd8, + 0x3e, 0xba, 0x5d, 0x8c, 0xdb, 0xcb, 0xd9, 0x19, 0xa7, 0x93, 0x4d, 0xe2, 0xf0, 0x0a, 0x6a, 0x41, + 0xed, 0x35, 0x57, 0x47, 0xf5, 0x78, 0xad, 0x7e, 0xbe, 0x96, 0xa3, 0x81, 0xe7, 0xb2, 0x20, 0x0a, + 0xe7, 0xce, 0x10, 0xb5, 0xfa, 0x53, 0xa8, 0xf3, 0xd1, 0x92, 0x41, 0x14, 0x26, 0x48, 0x1f, 0xc2, + 0xf2, 0x1b, 0x61, 0x15, 0x3e, 0x61, 0x46, 0x64, 0xe9, 0x15, 0x23, 0xd3, 0xcd, 0x39, 0xcb, 0xd0, + 0xc7, 0x12, 0xc0, 0x61, 0x7a, 0x46, 0x4c, 0x65, 0x6c, 0x72, 0x69, 0xb9, 0xa4, 0x4b, 0xcb, 0x25, + 0xcf, 0xc8, 0x65, 0xc2, 0xca, 0x01, 0x26, 0x89, 0xeb, 0xa3, 0x6d, 0x71, 0x25, 0x57, 0xdb, 0x37, + 0xc5, 0x75, 0x25, 0xe0, 0x94, 0x4b, 0x7a, 0x17, 0x56, 0x5e, 0x05, 0x7e, 0xe8, 0xb2, 0x34, 0x46, + 0xa1, 0x70, 0x19, 0xb8, 0x72, 0x1d, 0x4c, 0xa8, 0x73, 0x26, 0x85, 0x0e, 0xbf, 0xf4, 0x98, 0xfe, + 0x89, 0x40, 0xfd, 0x45, 0x90, 0xfc, 0x09, 0xf9, 0x57, 0x3d, 0xeb, 0x0e, 0xac, 0xe6, 0x9d, 0x8b, + 0x61, 0xef, 0xc1, 0x62, 0x66, 0xac, 0x44, 0x25, 0x4d, 0xf9, 0x42, 0xc7, 0xe5, 0xb0, 0xfe, 0x41, + 0x82, 0x6b, 0x16, 0x1e, 0x23, 0xc3, 0x7f, 0xf2, 0x2a, 0xce, 0x38, 0x4a, 0xfe, 0x5d, 0x47, 0x29, + 0xff, 0x9b, 0xa3, 0xd6, 0xe0, 0x7a, 0x41, 0x56, 0xce, 0xf3, 0xf6, 0x0f, 0x52, 0xbe, 0xdd, 0x74, + 0x07, 0xe4, 0x3d, 0x64, 0x74, 0xbd, 0x4a, 0x76, 0xf9, 0x91, 0xd3, 0xee, 0xcc, 0xc5, 0x85, 0x58, + 0x3b, 0x20, 0x1f, 0xa6, 0xe7, 0xea, 0xca, 0x6f, 0xc0, 0x6c, 0x5d, 0xd5, 0xd1, 0x4f, 0x40, 0xc9, + 0x44, 0xa7, 0x33, 0x09, 0x15, 0x03, 0x6b, 0xea, 0x3c, 0x20, 0x4a, 0x9f, 0x41, 0x2d, 0x9f, 0x84, + 0x6e, 0x54, 0x73, 0x66, 0xac, 0xa0, 0x69, 0x17, 0x41, 0xf9, 0x01, 0xed, 0xdd, 0xf1, 0xb4, 0x41, + 0x4e, 0xa7, 0x0d, 0xf2, 0x79, 0xda, 0x20, 0xdf, 0xa6, 0x0d, 0xf2, 0xfe, 0x7b, 0x63, 0xe1, 0xed, + 0x83, 0xca, 0x7f, 0x2b, 0x4c, 0x06, 0x9e, 0xb7, 0xd5, 0xc5, 0xa1, 0x19, 0x62, 0x74, 0x94, 0x6c, + 0xe5, 0x7f, 0xad, 0xf2, 0xc4, 0x4e, 0x8d, 0x47, 0x1e, 0xfd, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xd3, + 0x26, 0xc1, 0xc6, 0x55, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -831,11 +812,30 @@ func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x18 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 { size := m.OwnerID.Size() i -= size @@ -922,11 +922,30 @@ func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x30 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if len(m.Signature) > 0 { i -= len(m.Signature) copy(dAtA[i:], m.Signature) @@ -1035,11 +1054,30 @@ func (m *ListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x10 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 { size := m.OwnerID.Size() i -= size @@ -1118,11 +1156,30 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintWithdraw(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x28 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWithdraw(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if len(m.Signature) > 0 { i -= len(m.Signature) copy(dAtA[i:], m.Signature) @@ -1238,9 +1295,10 @@ func (m *GetRequest) Size() (n int) { n += 1 + l + sovWithdraw(uint64(l)) l = m.OwnerID.Size() n += 1 + l + sovWithdraw(uint64(l)) - if m.TTL != 0 { - n += 1 + sovWithdraw(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1284,9 +1342,10 @@ func (m *PutRequest) Size() (n int) { if l > 0 { n += 1 + l + sovWithdraw(uint64(l)) } - if m.TTL != 0 { - n += 1 + sovWithdraw(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1315,9 +1374,10 @@ func (m *ListRequest) Size() (n int) { _ = l l = m.OwnerID.Size() n += 1 + l + sovWithdraw(uint64(l)) - if m.TTL != 0 { - n += 1 + sovWithdraw(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1358,9 +1418,10 @@ func (m *DeleteRequest) Size() (n int) { if l > 0 { n += 1 + l + sovWithdraw(uint64(l)) } - if m.TTL != 0 { - n += 1 + sovWithdraw(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovWithdraw(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1689,11 +1750,11 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowWithdraw @@ -1703,11 +1764,58 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipWithdraw(dAtA[iNdEx:]) @@ -2007,11 +2115,11 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { m.Signature = []byte{} } iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowWithdraw @@ -2021,11 +2129,58 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipWithdraw(dAtA[iNdEx:]) @@ -2200,11 +2355,11 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowWithdraw @@ -2214,11 +2369,58 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipWithdraw(dAtA[iNdEx:]) @@ -2494,11 +2696,11 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { m.Signature = []byte{} } iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowWithdraw @@ -2508,11 +2710,58 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWithdraw + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWithdraw + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWithdraw + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipWithdraw(dAtA[iNdEx:]) diff --git a/accounting/withdraw.proto b/accounting/withdraw.proto index eb58d08..bb950ba 100644 --- a/accounting/withdraw.proto +++ b/accounting/withdraw.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package accounting; option go_package = "github.com/nspcc-dev/neofs-proto/accounting"; +import "service/meta.proto"; +import "service/verify.proto"; import "decimal/decimal.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -34,12 +36,13 @@ message Item { message GetRequest { // ID is cheque identifier - bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; + bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; // OwnerID is a wallet address - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 3; + bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message GetResponse { @@ -49,18 +52,19 @@ message GetResponse { message PutRequest { // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // Amount of funds - decimal.Decimal Amount = 2; + decimal.Decimal Amount = 2; // Height is the neo blockchain height until the cheque is valid - uint64 Height = 3; + uint64 Height = 3; // MessageID is a nonce for uniq request (UUIDv4) - bytes MessageID = 4 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; + bytes MessageID = 4 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; // Signature is a signature of the sent request - bytes Signature = 5; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 6; + bytes Signature = 5; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message PutResponse { // ID is cheque identifier @@ -69,10 +73,11 @@ message PutResponse { message ListRequest { // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 2; + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message ListResponse { @@ -82,16 +87,17 @@ message ListResponse { message DeleteRequest { // ID is cheque identifier - bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; + bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; // OwnerID is a wallet address - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // MessageID is a nonce for uniq request (UUIDv4) - bytes MessageID = 3 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; + bytes MessageID = 3 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; // Signature is a signature of the sent request - bytes Signature = 4; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 5; + bytes Signature = 4; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } // DeleteResponse is empty diff --git a/bootstrap/service.go b/bootstrap/service.go index 6d0d3ca..e67ea6d 100644 --- a/bootstrap/service.go +++ b/bootstrap/service.go @@ -6,6 +6,3 @@ import ( // NodeType type alias. type NodeType = service.NodeRole - -// SetTTL sets ttl to Request to satisfy TTLRequest interface. -func (m *Request) SetTTL(v uint32) { m.TTL = v } diff --git a/bootstrap/service.pb.go b/bootstrap/service.pb.go index f00f814..7165399 100644 --- a/bootstrap/service.pb.go +++ b/bootstrap/service.pb.go @@ -8,6 +8,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" + service "github.com/nspcc-dev/neofs-proto/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -32,12 +33,13 @@ type Request struct { Type NodeType `protobuf:"varint,1,opt,name=type,proto3,customtype=NodeType" json:"type"` // Info contains information about node Info NodeInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Request) Reset() { *m = Request{} } @@ -76,13 +78,6 @@ func (m *Request) GetInfo() NodeInfo { return NodeInfo{} } -func (m *Request) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - func init() { proto.RegisterType((*Request)(nil), "bootstrap.Request") } @@ -90,25 +85,29 @@ func init() { func init() { proto.RegisterFile("bootstrap/service.proto", fileDescriptor_21bce759c9d8eb63) } var fileDescriptor_21bce759c9d8eb63 = []byte{ - // 284 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xca, 0xcf, 0x2f, - 0x29, 0x2e, 0x29, 0x4a, 0x2c, 0xd0, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0x4b, 0x48, 0x89, 0x22, 0xd4, 0x94, 0x54, 0x16, 0xa4, 0x16, - 0x43, 0x54, 0x48, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, - 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0x85, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07,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xeb, 0x42, 0xbc, 0x0f, 0x37, 0x2b, 0x89, 0x0d, 0x2c, 0x60, 0x0c, 0x08, - 0x00, 0x00, 0xff, 0xff, 0xdf, 0x93, 0xe2, 0x48, 0x70, 0x01, 0x00, 0x00, + // 342 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x50, 0xbd, 0x4e, 0xeb, 0x30, + 0x14, 0xae, 0xaf, 0x72, 0xfb, 0xe3, 0xbb, 0xf9, 0x16, 0x11, 0x65, 0x48, 0xaa, 0x4e, 0x15, 0x22, + 0x89, 0xd4, 0x2e, 0x8c, 0x55, 0xc4, 0x00, 0x43, 0x11, 0x0a, 0x88, 0x81, 0xcd, 0x71, 0x4e, 0x4a, + 0x86, 0xc6, 0xc6, 0x76, 0x2b, 0xf5, 0x4d, 0x78, 0xa4, 0x8e, 0x1d, 0x11, 0x43, 0x84, 0x82, 0xc4, + 0x73, 0xa0, 0xb8, 0x69, 0xa9, 0x60, 0xb2, 0xcf, 0xf7, 0xe7, 0xe3, 0x0f, 0x9f, 0x26, 0x9c, 0x6b, + 0xa5, 0x25, 0x15, 0xa1, 0x02, 0xb9, 0xca, 0x19, 0x04, 0x42, 0x72, 0xcd, 0x49, 0xef, 0x40, 0x38, + 0xa4, 0x61, 0xc2, 0x05, 0x68, 0xba, 0xa3, 0x9d, 0xfe, 0x1e, 0x5b, 0x81, 0xcc, 0xb3, 0x75, 0x83, + 0x9e, 0x7c, 0xa7, 0xe9, 0xb5, 0x00, 0xd5, 0xc0, 0xfe, 0x3c, 0xd7, 0x4f, 0xcb, 0x24, 0x60, 0x7c, + 0x11, 0xce, 0xf9, 0x9c, 0x87, 0x06, 0x4e, 0x96, 0x99, 0x99, 0xcc, 0x60, 0x6e, 0x3b, 0xf9, 0xf0, + 0x13, 0xe1, 0x4e, 0x0c, 0xcf, 0x4b, 0x50, 0x9a, 0x9c, 0x63, 0xab, 0x4e,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x09, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -217,11 +216,30 @@ func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x18 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 { size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -262,9 +280,10 @@ func (m *Request) Size() (n int) { } l = m.Info.Size() n += 1 + l + sovService(uint64(l)) - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -358,11 +377,11 @@ func (m *Request) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -372,11 +391,58 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/bootstrap/service.proto b/bootstrap/service.proto index cde94dc..f0bf755 100644 --- a/bootstrap/service.proto +++ b/bootstrap/service.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package bootstrap; option go_package = "github.com/nspcc-dev/neofs-proto/bootstrap"; +import "service/meta.proto"; +import "service/verify.proto"; import "bootstrap/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -17,10 +19,11 @@ service Bootstrap { message Request { // Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) - int32 type = 1 [(gogoproto.customname) = "Type" , (gogoproto.nullable) = false, (gogoproto.customtype) = "NodeType"]; + int32 type = 1 [(gogoproto.customname) = "Type" , (gogoproto.nullable) = false, (gogoproto.customtype) = "NodeType"]; // Info contains information about node - bootstrap.NodeInfo info = 2 [(gogoproto.nullable) = false]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 3; + bootstrap.NodeInfo info = 2 [(gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } diff --git a/container/service.go b/container/service.go index 27f39e7..4d3747e 100644 --- a/container/service.go +++ b/container/service.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/binary" + "github.com/nspcc-dev/neofs-proto/internal" "github.com/nspcc-dev/neofs-proto/refs" "github.com/pkg/errors" ) @@ -19,17 +20,10 @@ type ( MessageID = refs.MessageID ) -// SetTTL sets ttl to GetRequest to satisfy TTLRequest interface. -func (m *GetRequest) SetTTL(v uint32) { m.TTL = v } - -// SetTTL sets ttl to PutRequest to satisfy TTLRequest interface. -func (m *PutRequest) SetTTL(v uint32) { m.TTL = v } - -// SetTTL sets ttl to ListRequest to satisfy TTLRequest interface. -func (m *ListRequest) SetTTL(v uint32) { m.TTL = v } - -// SetTTL sets ttl to DeleteRequest to satisfy TTLRequest interface. -func (m *DeleteRequest) SetTTL(v uint32) { m.TTL = v } +const ( + // ErrNotFound is raised when container could not be found. + ErrNotFound = internal.Error("could not find container") +) // SetSignature sets signature to PutRequest to satisfy SignedRequest interface. func (m *PutRequest) SetSignature(v []byte) { m.Signature = v } diff --git a/container/service.pb.go b/container/service.pb.go index cfd401d..8b98cfa 100644 --- a/container/service.pb.go +++ b/container/service.pb.go @@ -8,6 +8,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" + service "github.com/nspcc-dev/neofs-proto/service" netmap "github.com/nspcc-dev/netmap" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -39,12 +40,13 @@ type PutRequest struct { Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules"` // Signature of the user (owner id) Signature []byte `protobuf:"bytes,5,opt,name=Signature,proto3" json:"Signature,omitempty"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,6,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest) Reset() { *m = PutRequest{} } @@ -97,13 +99,6 @@ func (m *PutRequest) GetSignature() []byte { return nil } -func (m *PutRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type PutResponse struct { // CID (container id) is a SHA256 hash of the container structure CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` @@ -144,14 +139,15 @@ var xxx_messageInfo_PutResponse proto.InternalMessageInfo type DeleteRequest struct { // CID (container id) is a SHA256 hash of the container structure CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` // Signature of the container owner - Signature []byte `protobuf:"bytes,3,opt,name=Signature,proto3" json:"Signature,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Signature []byte `protobuf:"bytes,2,opt,name=Signature,proto3" json:"Signature,omitempty"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } @@ -183,13 +179,6 @@ func (m *DeleteRequest) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo -func (m *DeleteRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - func (m *DeleteRequest) GetSignature() []byte { if m != nil { return m.Signature @@ -237,12 +226,13 @@ var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo type GetRequest struct { // CID (container id) is a SHA256 hash of the container structure CID CID `protobuf:"bytes,1,opt,name=CID,proto3,customtype=CID" json:"CID"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRequest) Reset() { *m = GetRequest{} } @@ -274,13 +264,6 @@ func (m *GetRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetRequest proto.InternalMessageInfo -func (m *GetRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type GetResponse struct { // Container is a structure that contains placement rules and owner id Container *Container `protobuf:"bytes,1,opt,name=Container,proto3" json:"Container,omitempty"` @@ -328,12 +311,13 @@ func (m *GetResponse) GetContainer() *Container { type ListRequest struct { // OwnerID is a wallet address OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,2,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ListRequest) Reset() { *m = ListRequest{} } @@ -365,13 +349,6 @@ func (m *ListRequest) XXX_DiscardUnknown() { var xxx_messageInfo_ListRequest proto.InternalMessageInfo -func (m *ListRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type ListResponse struct { // CID (container id) is list of SHA256 hashes of the container structures CID []CID `protobuf:"bytes,1,rep,name=CID,proto3,customtype=CID" json:"CID"` @@ -423,40 +400,44 @@ func init() { func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) } var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{ - // 520 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xcf, 0x6e, 0xd3, 0x4e, - 0x10, 0xee, 0xd6, 0x69, 0xfa, 0xcb, 0xb8, 0xfd, 0x51, 0x56, 0x84, 0x1a, 0x0b, 0xdc, 0xc8, 0xa7, - 0x80, 0x88, 0x2d, 0x42, 0x25, 0x4e, 0x95, 0x20, 0x89, 0x54, 0x15, 0x15, 0x11, 0x6d, 0x7b, 0xe2, - 0x80, 0xe4, 0x98, 0xa9, 0xb1, 0xe4, 0xd8, 0xc6, 0xbb, 0x2e, 0xea, 0x9b, 0xf0, 0x48, 0x3d, 0x72, - 0x44, 0x1c, 0x2a, 0x14, 0x0e, 0x9c, 0x78, 0x07, 0x64, 0xaf, 0xff, 0x25, 0x2d, 0x20, 0x71, 0x59, - 0xcd, 0xce, 0x7c, 0xf3, 0xcd, 0x37, 0x33, 0xbb, 0xb0, 0xeb, 0x46, 0xa1, 0x70, 0xfc, 0x10, 0x13, - 0x9b, 0x63, 0x72, 0xee, 0xbb, 0x68, 0xc5, 0x49, 0x24, 0x22, 0xda, 0xa9, 0x02, 0x7a, 0xb7, 0xc6, - 0x88, 0x8b, 0x18, 0xb9, 0x44, 0xe8, 0x8f, 0x3c, 0x5f, 0xbc, 0x4f, 0x67, 0x96, 0x1b, 0xcd, 0xed, - 0x90, 0xc7, 0xae, 0x3b, 0x78, 0x87, 0xe7, 0x76, 0x88, 0x62, 0xee, 0xc4, 0x36, 0xc7, 0x00, 0x5d, - 0x11, 0x25, 0x05, 0x76, 0xd0, 0xc0, 0x7a, 0x91, 0x17, 0xd9, 0xb9, 0x7b, 0x96, 0x9e, 0xe5, 0xb7, - 0xfc, 0x92, 0x5b, 0x12, 0x6e, 0xfe, 0x20, 0x00, 0xd3, 0x54, 0x30, 0xfc, 0x90, 0x22, 0x17, 0xd4, - 0x86, 0xce, 0x2b, 0xe4, 0xdc, 0xf1, 0xf0, 0x68, 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, 0x96, 0x72, - 0x16, 0x75, 0x78, 0xc7, 0xaa, 0x5e, 0x97, 0x55, 0xc5, 0x58, 0x0d, 0x33, 0x5f, 0x82, 0x7a, 0xec, - 0xf3, 0x4a, 0x42, 0x63, 0x7d, 0xe4, 0x2f, 0xeb, 0xbb, 0x2e, 0x67, 0x00, 0x5b, 0x92, 0x6b, 0x75, - 0xdc, 0xca, 0x4d, 0xfd, 0x0c, 0x7f, 0x12, 0xd8, 0x3c, 0x91, 0xbf, 0x82, 0xee, 0x83, 0x32, 0x4d, - 0x05, 0xed, 0x36, 0xe4, 0xd6, 0x2f, 0x54, 0xbf, 0xbb, 0xea, 0x2e, 0x0a, 0x1c, 0x40, 0x5b, 0x0e, - 0x94, 0x6a, 0x0d, 0xc4, 0xd2, 0x0e, 0xf5, 0x7b, 0x37, 0x44, 0x8a, 0xf4, 0x7d, 0x50, 0x0e, 0x71, - 0xb9, 0x68, 0xbd, 0x8d, 0xa5, 0xa2, 0xcd, 0x29, 0x3f, 0x83, 0x56, 0xd6, 0x25, 0x6d, 0xc6, 0x1b, - 0x23, 0xd4, 0x77, 0xaf, 0xf9, 0x65, 0xe2, 0xe8, 0xf9, 0xe5, 0xc2, 0x20, 0x9f, 0x17, 0x06, 0xf9, - 0xb2, 0x30, 0xc8, 0xb7, 0x85, 0x41, 0x3e, 0x7d, 0x37, 0xd6, 0xde, 0xfc, 0xee, 0x9f, 0x47, 0x67, - 0x7c, 0x20, 0x7f, 0x6e, 0x45, 0x37, 0x6b, 0xe7, 0x8e, 0xa7, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, - 0xa3, 0xe9, 0x55, 0x5c, 0x57, 0x04, 0x00, 0x00, + // 586 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0xed, 0x34, 0x69, 0xda, 0x5c, 0xf7, 0xfb, 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0x0d, 0x2b, 0x02, 0x78, 0xf8, 0x33, 0x00, 0x00, + 0xff, 0xff, 0xd2, 0x95, 0x12, 0x0c, 0x3c, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -685,11 +666,30 @@ func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x30 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if len(m.Signature) > 0 { i -= len(m.Signature) copy(dAtA[i:], m.Signature) @@ -796,17 +796,36 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if len(m.Signature) > 0 { i -= len(m.Signature) copy(dAtA[i:], m.Signature) i = encodeVarintService(dAtA, i, uint64(len(m.Signature))) i-- - dAtA[i] = 0x1a - } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } { size := m.CID.Size() @@ -872,11 +891,30 @@ func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x10 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 { size := m.CID.Size() i -= size @@ -953,11 +991,30 @@ func (m *ListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x10 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 { size := m.OwnerID.Size() i -= size @@ -1042,9 +1099,10 @@ func (m *PutRequest) Size() (n int) { if l > 0 { n += 1 + l + sovService(uint64(l)) } - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1073,13 +1131,14 @@ func (m *DeleteRequest) Size() (n int) { _ = l l = m.CID.Size() n += 1 + l + sovService(uint64(l)) - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } l = len(m.Signature) if l > 0 { n += 1 + l + sovService(uint64(l)) } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1106,9 +1165,10 @@ func (m *GetRequest) Size() (n int) { _ = l l = m.CID.Size() n += 1 + l + sovService(uint64(l)) - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1139,9 +1199,10 @@ func (m *ListRequest) Size() (n int) { _ = l l = m.OwnerID.Size() n += 1 + l + sovService(uint64(l)) - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1353,11 +1414,11 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { m.Signature = []byte{} } iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -1367,11 +1428,58 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -1547,25 +1655,6 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) - } - m.TTL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TTL |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) } @@ -1599,6 +1688,72 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { m.Signature = []byte{} } iNdEx = postIndex + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -1740,11 +1895,11 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -1754,11 +1909,58 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -1936,11 +2138,11 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -1950,11 +2152,58 @@ func (m *ListRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/container/service.proto b/container/service.proto index 1cf8227..d4d50ca 100644 --- a/container/service.proto +++ b/container/service.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package container; option go_package = "github.com/nspcc-dev/neofs-proto/container"; +import "service/meta.proto"; +import "service/verify.proto"; import "container/types.proto"; import "github.com/nspcc-dev/netmap/selector.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -28,23 +30,24 @@ service Service { message PutRequest { // MessageID is a nonce for uniq container id calculation - bytes MessageID = 1 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; + bytes MessageID = 1 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; // Capacity defines amount of data that can be stored in the container (doesn't used for now). - uint64 Capacity = 2; + uint64 Capacity = 2; // OwnerID is a wallet address - bytes OwnerID = 3 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + bytes OwnerID = 3 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; // Rules define storage policy for the object inside the container. - netmap.PlacementRule rules = 4 [(gogoproto.nullable) = false]; + netmap.PlacementRule rules = 4 [(gogoproto.nullable) = false]; // Signature of the user (owner id) - bytes Signature = 5; + bytes Signature = 5; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 6; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message PutResponse { @@ -54,14 +57,15 @@ message PutResponse { message DeleteRequest { // CID (container id) is a SHA256 hash of the container structure - bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; - - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 2; + bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; // Signature of the container owner - bytes Signature = 3; + bytes Signature = 2; + + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } // DeleteResponse is empty because delete operation is asynchronous and done @@ -71,11 +75,12 @@ message DeleteResponse { } message GetRequest { // CID (container id) is a SHA256 hash of the container structure - bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; + bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 2; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message GetResponse { @@ -85,11 +90,11 @@ message GetResponse { message ListRequest { // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 2; + bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message ListResponse { diff --git a/docs/accounting.md b/docs/accounting.md index b4317ae..268a187 100644 --- a/docs/accounting.md +++ b/docs/accounting.md @@ -87,7 +87,8 @@ Balance returns current balance status of the NeoFS user | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -362,7 +363,8 @@ Delete allows user to remove unused cheque | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | | MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq request (UUIDv4) | | Signature | [bytes](#bytes) | | Signature is a signature of the sent request | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -382,7 +384,8 @@ DeleteResponse is empty | ----- | ---- | ----- | ----------- | | ID | [bytes](#bytes) | | ID is cheque identifier | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -420,7 +423,8 @@ DeleteResponse is empty | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -447,7 +451,8 @@ DeleteResponse is empty | Height | [uint64](#uint64) | | Height is the neo blockchain height until the cheque is valid | | MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq request (UUIDv4) | | Signature | [bytes](#bytes) | | Signature is a signature of the sent request | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/docs/bootstrap.md b/docs/bootstrap.md index 19967bf..737e085 100644 --- a/docs/bootstrap.md +++ b/docs/bootstrap.md @@ -62,7 +62,8 @@ Process is method that allows to register node in the network and receive actual | ----- | ---- | ----- | ----------- | | type | [int32](#int32) | | Type is NodeType, can be InnerRingNode (type=1) or StorageNode (type=2) | | info | [NodeInfo](#bootstrap.NodeInfo) | | Info contains information about node | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/docs/container.md b/docs/container.md index 4f98a47..bc559ce 100644 --- a/docs/container.md +++ b/docs/container.md @@ -92,8 +92,9 @@ List returns all user's containers | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | CID | [bytes](#bytes) | | CID (container id) is a SHA256 hash of the container structure | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Signature | [bytes](#bytes) | | Signature of the container owner | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -113,7 +114,8 @@ via consensus in inner ring nodes | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | CID | [bytes](#bytes) | | CID (container id) is a SHA256 hash of the container structure | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -136,7 +138,8 @@ via consensus in inner ring nodes | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -163,7 +166,8 @@ via consensus in inner ring nodes | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | | rules | [netmap.PlacementRule](#netmap.PlacementRule) | | Rules define storage policy for the object inside the container. | | Signature | [bytes](#bytes) | | Signature of the user (owner id) | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/docs/object.md b/docs/object.md index 03e41c8..8407733 100644 --- a/docs/object.md +++ b/docs/object.md @@ -147,11 +147,11 @@ calculated for XORed data. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Token | [session.Token](#session.Token) | | Token with session public key and user's signature | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -170,11 +170,11 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | Ranges | [Range](#object.Range) | repeated | Ranges of object's payload to calculate homomorphic hash | | Salt | [bytes](#bytes) | | Salt is used to XOR object's payload ranges before hashing, it can be nil | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -196,10 +196,10 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | Ranges | [Range](#object.Range) | repeated | Ranges of object's payload to return | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -221,9 +221,9 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -246,10 +246,10 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch should be empty on user side, node sets epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | | FullHeaders | [bool](#bool) | | FullHeaders can be set true for extended headers in the object | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -273,6 +273,8 @@ in distributed system. | ----- | ---- | ----- | ----------- | | Header | [PutRequest.PutHeader](#object.PutRequest.PutHeader) | | Header should be the first message in the stream | | Chunk | [bytes](#bytes) | | Chunk should be a remaining message in stream should be chunks | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | @@ -283,9 +285,7 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Object | [Object](#object.Object) | | Object with at least container id and owner id fields | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | | Token | [session.Token](#session.Token) | | Token with session public key and user's signature | @@ -308,11 +308,11 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch is set by user to 0, node set epoch to the actual value Deprecated: will be replaced with RequestMetaHeader (see develop branch) | -| Version | [uint32](#uint32) | | Version of search query format | | ContainerID | [bytes](#bytes) | | ContainerID for searching the object | | Query | [bytes](#bytes) | | Query in the binary serialized format | -| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every neofs-node Deprecated: will be replaced with RequestMetaHeader (see develop branch) | +| QueryVersion | [uint32](#uint32) | | QueryVersion is a version of search query format | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/docs/service.md b/docs/service.md new file mode 100644 index 0000000..454fab4 --- /dev/null +++ b/docs/service.md @@ -0,0 +1,157 @@ +# Protocol Documentation + + +## Table of Contents + +- [service/meta.proto](#service/meta.proto) + + - Messages + - [RequestMetaHeader](#service.RequestMetaHeader) + + +- [service/verify.proto](#service/verify.proto) + + - Messages + - [RequestVerificationHeader](#service.RequestVerificationHeader) + - [RequestVerificationHeader.Sign](#service.RequestVerificationHeader.Sign) + - [RequestVerificationHeader.Signature](#service.RequestVerificationHeader.Signature) + + +- [service/verify_test.proto](#service/verify_test.proto) + + - Messages + - [TestRequest](#service.TestRequest) + + +- [Scalar Value Types](#scalar-value-types) + + + + +

Top

+ +## service/meta.proto + + + + + + + +### Message RequestMetaHeader +RequestMetaHeader contains information about request meta headers +(should be embedded into message) + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| TTL | [uint32](#uint32) | | TTL must be larger than zero, it decreased in every NeoFS Node | +| Epoch | [uint64](#uint64) | | Epoch for user can be empty, because node sets epoch to the actual value | +| Version | [uint32](#uint32) | | Version defines protocol version TODO: not used for now, should be implemented in future | + + + + + + + + +

Top

+ +## service/verify.proto + + + + + + + +### Message RequestVerificationHeader +RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request +(should be embedded into message). + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Signatures | [RequestVerificationHeader.Signature](#service.RequestVerificationHeader.Signature) | repeated | Signatures is a set of signatures of every passed NeoFS Node | + + + + +### Message RequestVerificationHeader.Sign + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Sign | [bytes](#bytes) | | Sign is signature of the request or session key. | +| Peer | [bytes](#bytes) | | Peer is compressed public key used for signature. | + + + + +### Message RequestVerificationHeader.Signature + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Sign | [RequestVerificationHeader.Sign](#service.RequestVerificationHeader.Sign) | | Sign is a signature and public key of the request. | +| Origin | [RequestVerificationHeader.Sign](#service.RequestVerificationHeader.Sign) | | Origin used for requests, when trusted node changes it and re-sign with session key. If session key used for signature request, then Origin should contain public key of user and signed session key. | + + + + + + + + +

Top

+ +## service/verify_test.proto + + + + + + + +### Message TestRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| IntField | [int32](#int32) | | | +| StringField | [string](#string) | | | +| BytesField | [bytes](#bytes) | | | +| CustomField | [bytes](#bytes) | | | +| Meta | [RequestMetaHeader](#service.RequestMetaHeader) | | | +| Header | [RequestVerificationHeader](#service.RequestVerificationHeader) | | | + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ Type | Java Type | Python Type | +| ----------- | ----- | -------- | --------- | ----------- | +| double | | double | double | float | +| float | | float | float | float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | +| sfixed32 | Always four bytes. | int32 | int | int | +| sfixed64 | Always eight bytes. | int64 | long | int/long | +| bool | | bool | boolean | boolean | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | + diff --git a/docs/session.md b/docs/session.md index cf4a1fd..e8633d3 100644 --- a/docs/session.md +++ b/docs/session.md @@ -70,6 +70,8 @@ session key. Session is established during 4-step handshake in one gRPC stream | ----- | ---- | ----- | ----------- | | Init | [Token](#session.Token) | | Init is a message to initialize session opening. Carry: owner of manipulation object; ID of manipulation object; token lifetime bounds. | | Signed | [Token](#session.Token) | | Signed Init message response (Unsigned) from server with user private key | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/docs/state.md b/docs/state.md index 6d240c1..e678be3 100644 --- a/docs/state.md +++ b/docs/state.md @@ -70,6 +70,11 @@ If node unhealthy field Status would contains detailed info. HealthRequest message to check current state +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | + @@ -89,6 +94,11 @@ HealthResponse message with current state MetricsRequest message to request node metrics +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | + @@ -109,6 +119,11 @@ from github.com/prometheus/client_model/metrics.proto NetmapRequest message to request current node netmap +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | +| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | + diff --git a/object/service.go b/object/service.go index 098f9c3..8482539 100644 --- a/object/service.go +++ b/object/service.go @@ -31,8 +31,7 @@ type ( // All object operations must have TTL, Epoch, Container ID and // permission of usage previous network map. Request interface { - service.TTLRequest - service.EpochRequest + service.MetaHeader CID() CID AllowPreviousNetMap() bool @@ -124,54 +123,6 @@ func (m *GetResponse) NotFull() bool { return checkIsNotFull(m) } // NotFull checks if protobuf stream provided whole object for put operation. func (m *PutRequest) NotFull() bool { return checkIsNotFull(m) } -// GetTTL returns TTL value from object put request. -func (m *PutRequest) GetTTL() uint32 { return m.GetHeader().TTL } - -// GetEpoch returns epoch value from object put request. -func (m *PutRequest) GetEpoch() uint64 { return m.GetHeader().GetEpoch() } - -// SetTTL sets TTL value into object put request. -func (m *PutRequest) SetTTL(ttl uint32) { m.GetHeader().TTL = ttl } - -// SetTTL sets TTL value into object get request. -func (m *GetRequest) SetTTL(ttl uint32) { m.TTL = ttl } - -// SetTTL sets TTL value into object head request. -func (m *HeadRequest) SetTTL(ttl uint32) { m.TTL = ttl } - -// SetTTL sets TTL value into object search request. -func (m *SearchRequest) SetTTL(ttl uint32) { m.TTL = ttl } - -// SetTTL sets TTL value into object delete request. -func (m *DeleteRequest) SetTTL(ttl uint32) { m.TTL = ttl } - -// SetTTL sets TTL value into object get range request. -func (m *GetRangeRequest) SetTTL(ttl uint32) { m.TTL = ttl } - -// SetTTL sets TTL value into object get range hash request. -func (m *GetRangeHashRequest) SetTTL(ttl uint32) { m.TTL = ttl } - -// SetEpoch sets epoch value into object put request. -func (m *PutRequest) SetEpoch(v uint64) { m.GetHeader().Epoch = v } - -// SetEpoch sets epoch value into object get request. -func (m *GetRequest) SetEpoch(v uint64) { m.Epoch = v } - -// SetEpoch sets epoch value into object head request. -func (m *HeadRequest) SetEpoch(v uint64) { m.Epoch = v } - -// SetEpoch sets epoch value into object search request. -func (m *SearchRequest) SetEpoch(v uint64) { m.Epoch = v } - -// SetEpoch sets epoch value into object delete request. -func (m *DeleteRequest) SetEpoch(v uint64) { m.Epoch = v } - -// SetEpoch sets epoch value into object get range request. -func (m *GetRangeRequest) SetEpoch(v uint64) { m.Epoch = v } - -// SetEpoch sets epoch value into object get range hash request. -func (m *GetRangeHashRequest) SetEpoch(v uint64) { m.Epoch = v } - // CID returns container id value from object put request. func (m *PutRequest) CID() CID { return m.GetHeader().Object.SystemHeader.CID } diff --git a/object/service.pb.go b/object/service.pb.go index b19ed93..4cad2f7 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -9,6 +9,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" refs "github.com/nspcc-dev/neofs-proto/refs" + service "github.com/nspcc-dev/neofs-proto/service" session "github.com/nspcc-dev/neofs-proto/session" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -30,17 +31,15 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type GetRequest struct { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` // Address of object (container id + object id) - Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRequest) Reset() { *m = GetRequest{} } @@ -72,13 +71,6 @@ func (m *GetRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetRequest proto.InternalMessageInfo -func (m *GetRequest) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - func (m *GetRequest) GetAddress() refs.Address { if m != nil { return m.Address @@ -86,13 +78,6 @@ func (m *GetRequest) GetAddress() refs.Address { return refs.Address{} } -func (m *GetRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type GetResponse struct { // Types that are valid to be assigned to R: // *GetResponse_Object @@ -181,10 +166,14 @@ type PutRequest struct { // Types that are valid to be assigned to R: // *PutRequest_Header // *PutRequest_Chunk - R isPutRequest_R `protobuf_oneof:"R"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + R isPutRequest_R `protobuf_oneof:"R"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PutRequest) Reset() { *m = PutRequest{} } @@ -262,16 +251,10 @@ func (*PutRequest) XXX_OneofWrappers() []interface{} { } type PutRequest_PutHeader struct { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` // Object with at least container id and owner id fields - Object *Object `protobuf:"bytes,2,opt,name=Object,proto3" json:"Object,omitempty"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,3,opt,name=TTL,proto3" json:"TTL,omitempty"` + Object *Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"` // Token with session public key and user's signature - Token *session.Token `protobuf:"bytes,4,opt,name=Token,proto3" json:"Token,omitempty"` + Token *session.Token `protobuf:"bytes,2,opt,name=Token,proto3" json:"Token,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -306,13 +289,6 @@ func (m *PutRequest_PutHeader) XXX_DiscardUnknown() { var xxx_messageInfo_PutRequest_PutHeader proto.InternalMessageInfo -func (m *PutRequest_PutHeader) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - func (m *PutRequest_PutHeader) GetObject() *Object { if m != nil { return m.Object @@ -320,13 +296,6 @@ func (m *PutRequest_PutHeader) GetObject() *Object { return nil } -func (m *PutRequest_PutHeader) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - func (m *PutRequest_PutHeader) GetToken() *session.Token { if m != nil { return m.Token @@ -379,21 +348,19 @@ func (m *PutResponse) GetAddress() refs.Address { } type DeleteRequest struct { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` // Address of object (container id + object id) - Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` + Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` // OwnerID is a wallet address - OwnerID OwnerID `protobuf:"bytes,3,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,4,opt,name=TTL,proto3" json:"TTL,omitempty"` + OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` // Token with session public key and user's signature - Token *session.Token `protobuf:"bytes,5,opt,name=Token,proto3" json:"Token,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Token *session.Token `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *DeleteRequest) Reset() { *m = DeleteRequest{} } @@ -425,13 +392,6 @@ func (m *DeleteRequest) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo -func (m *DeleteRequest) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - func (m *DeleteRequest) GetAddress() refs.Address { if m != nil { return m.Address @@ -439,13 +399,6 @@ func (m *DeleteRequest) GetAddress() refs.Address { return refs.Address{} } -func (m *DeleteRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - func (m *DeleteRequest) GetToken() *session.Token { if m != nil { return m.Token @@ -491,19 +444,17 @@ func (m *DeleteResponse) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo type HeadRequest struct { - // Epoch should be empty on user side, node sets epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` // Address of object (container id + object id) - Address Address `protobuf:"bytes,2,opt,name=Address,proto3,customtype=Address" json:"Address"` + Address Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=Address" json:"Address"` // FullHeaders can be set true for extended headers in the object - FullHeaders bool `protobuf:"varint,3,opt,name=FullHeaders,proto3" json:"FullHeaders,omitempty"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,4,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + FullHeaders bool `protobuf:"varint,2,opt,name=FullHeaders,proto3" json:"FullHeaders,omitempty"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *HeadRequest) Reset() { *m = HeadRequest{} } @@ -535,13 +486,6 @@ func (m *HeadRequest) XXX_DiscardUnknown() { var xxx_messageInfo_HeadRequest proto.InternalMessageInfo -func (m *HeadRequest) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - func (m *HeadRequest) GetFullHeaders() bool { if m != nil { return m.FullHeaders @@ -549,13 +493,6 @@ func (m *HeadRequest) GetFullHeaders() bool { return false } -func (m *HeadRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type HeadResponse struct { // Object without payload Object *Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"` @@ -601,21 +538,19 @@ func (m *HeadResponse) GetObject() *Object { } type SearchRequest struct { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` - // Version of search query format - Version uint32 `protobuf:"varint,2,opt,name=Version,proto3" json:"Version,omitempty"` // ContainerID for searching the object - ContainerID CID `protobuf:"bytes,3,opt,name=ContainerID,proto3,customtype=CID" json:"ContainerID"` + ContainerID CID `protobuf:"bytes,1,opt,name=ContainerID,proto3,customtype=CID" json:"ContainerID"` // Query in the binary serialized format - Query []byte `protobuf:"bytes,4,opt,name=Query,proto3" json:"Query,omitempty"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Query []byte `protobuf:"bytes,2,opt,name=Query,proto3" json:"Query,omitempty"` + // QueryVersion is a version of search query format + QueryVersion uint32 `protobuf:"varint,3,opt,name=QueryVersion,proto3" json:"QueryVersion,omitempty"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SearchRequest) Reset() { *m = SearchRequest{} } @@ -647,20 +582,6 @@ func (m *SearchRequest) XXX_DiscardUnknown() { var xxx_messageInfo_SearchRequest proto.InternalMessageInfo -func (m *SearchRequest) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - -func (m *SearchRequest) GetVersion() uint32 { - if m != nil { - return m.Version - } - return 0 -} - func (m *SearchRequest) GetQuery() []byte { if m != nil { return m.Query @@ -668,9 +589,9 @@ func (m *SearchRequest) GetQuery() []byte { return nil } -func (m *SearchRequest) GetTTL() uint32 { +func (m *SearchRequest) GetQueryVersion() uint32 { if m != nil { - return m.TTL + return m.QueryVersion } return 0 } @@ -720,19 +641,17 @@ func (m *SearchResponse) GetAddresses() []refs.Address { } type GetRangeRequest struct { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` // Address of object (container id + object id) - Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` + Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` // Ranges of object's payload to return - Ranges []Range `protobuf:"bytes,3,rep,name=Ranges,proto3" json:"Ranges"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,4,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Ranges []Range `protobuf:"bytes,2,rep,name=Ranges,proto3" json:"Ranges"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeRequest) Reset() { *m = GetRangeRequest{} } @@ -764,13 +683,6 @@ func (m *GetRangeRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetRangeRequest proto.InternalMessageInfo -func (m *GetRangeRequest) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - func (m *GetRangeRequest) GetAddress() refs.Address { if m != nil { return m.Address @@ -785,13 +697,6 @@ func (m *GetRangeRequest) GetRanges() []Range { return nil } -func (m *GetRangeRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type GetRangeResponse struct { // Fragments of object's payload Fragments [][]byte `protobuf:"bytes,1,rep,name=Fragments,proto3" json:"Fragments,omitempty"` @@ -837,21 +742,19 @@ func (m *GetRangeResponse) GetFragments() [][]byte { } type GetRangeHashRequest struct { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"` // Address of object (container id + object id) - Address refs.Address `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address"` + Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` // Ranges of object's payload to calculate homomorphic hash - Ranges []Range `protobuf:"bytes,3,rep,name=Ranges,proto3" json:"Ranges"` + Ranges []Range `protobuf:"bytes,2,rep,name=Ranges,proto3" json:"Ranges"` // Salt is used to XOR object's payload ranges before hashing, it can be nil - Salt []byte `protobuf:"bytes,4,opt,name=Salt,proto3" json:"Salt,omitempty"` - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - TTL uint32 `protobuf:"varint,5,opt,name=TTL,proto3" json:"TTL,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Salt []byte `protobuf:"bytes,3,opt,name=Salt,proto3" json:"Salt,omitempty"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetRangeHashRequest) Reset() { *m = GetRangeHashRequest{} } @@ -883,13 +786,6 @@ func (m *GetRangeHashRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetRangeHashRequest proto.InternalMessageInfo -func (m *GetRangeHashRequest) GetEpoch() uint64 { - if m != nil { - return m.Epoch - } - return 0 -} - func (m *GetRangeHashRequest) GetAddress() refs.Address { if m != nil { return m.Address @@ -911,13 +807,6 @@ func (m *GetRangeHashRequest) GetSalt() []byte { return nil } -func (m *GetRangeHashRequest) GetTTL() uint32 { - if m != nil { - return m.TTL - } - return 0 -} - type GetRangeHashResponse struct { // Hashes is a homomorphic hashes of all ranges Hashes []Hash `protobuf:"bytes,1,rep,name=Hashes,proto3,customtype=Hash" json:"Hashes"` @@ -976,57 +865,59 @@ func init() { func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 793 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xc1, 0x4e, 0xdb, 0x4c, - 0x10, 0xce, 0xfe, 0x49, 0x1c, 0x18, 0x3b, 0x10, 0x2d, 0xf9, 0xf9, 0x23, 0xff, 0x28, 0x44, 0x16, - 0x6a, 0x53, 0x55, 0x49, 0x28, 0x95, 0xa0, 0x07, 0x38, 0x34, 0xa1, 0x10, 0xa4, 0x4a, 0xd0, 0x25, - 0xea, 0xa1, 0xb7, 0xc4, 0x59, 0x92, 0x94, 0x60, 0xa7, 0x5e, 0x9b, 0x8a, 0x63, 0x1f, 0xa1, 0x87, - 0x56, 0x3d, 0xf4, 0x15, 0x7a, 0xee, 0x2b, 0x70, 0xec, 0xb1, 0xea, 0x01, 0x55, 0xa9, 0xfa, 0x1e, - 0x95, 0x77, 0xd7, 0xb1, 0x13, 0x42, 0xb8, 0x20, 0xf5, 0xe4, 0x9d, 0x6f, 0x66, 0x77, 0xe6, 0x9b, - 0x6f, 0xbc, 0x0b, 0x59, 0xbb, 0xf5, 0x9a, 0x9a, 0x6e, 0x85, 0x51, 0xe7, 0xbc, 0x67, 0xd2, 0xf2, - 0xc0, 0xb1, 0x5d, 0x1b, 0x2b, 0x02, 0xd5, 0x33, 0x0e, 0x3d, 0x61, 0x15, 0xf7, 0x62, 0x40, 0x99, - 0xf0, 0xe8, 0x58, 0xc6, 0x47, 0xb1, 0x25, 0x46, 0x19, 0xeb, 0xd9, 0xd6, 0x18, 0x58, 0xea, 0xf4, - 0xdc, 0xae, 0xd7, 0x2a, 0x9b, 0xf6, 0x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e5, 0x12, 0x72, - 0xa3, 0xd4, 0xb2, 0xcc, 0x51, 0x22, 0x9c, 0x82, 0xe7, 0x36, 0xa8, 0x9c, 0x82, 0xec, 0x5e, 0x44, - 0x0d, 0x74, 0xbb, 0x1a, 0xc6, 0x57, 0x04, 0xe9, 0x5d, 0xda, 0xa7, 0x2e, 0xbd, 0x53, 0x91, 0x1f, - 0x40, 0xea, 0xf0, 0xad, 0x45, 0x9d, 0x83, 0x5d, 0xce, 0x4a, 0xab, 0x2e, 0xfa, 0xfe, 0x1f, 0x57, - 0xab, 0x01, 0x4c, 0x82, 0x45, 0x40, 0x3e, 0x31, 0x85, 0x7c, 0x72, 0x06, 0x79, 0x23, 0x03, 0x0b, - 0x41, 0xe1, 0x82, 0xba, 0xf1, 0x1e, 0x81, 0xea, 0xeb, 0x31, 0x9b, 0xc9, 0x93, 0x5b, 0x98, 0x8c, - 0x2a, 0x95, 0x40, 0x48, 0xaa, 0x00, 0xea, 0x9e, 0xd7, 0xef, 0x0b, 0xc9, 0x19, 0x27, 0x36, 0x47, - 0xa2, 0xd0, 0x75, 0x2e, 0xc6, 0x26, 0x68, 0xa2, 0x24, 0x29, 0x4f, 0x38, 0x12, 0x68, 0xd6, 0x48, - 0x18, 0x1f, 0x11, 0xa4, 0x8f, 0x69, 0xd3, 0x31, 0xbb, 0xb3, 0xd9, 0xe4, 0x20, 0xf5, 0x92, 0x3a, - 0x7e, 0x77, 0x38, 0x9b, 0x34, 0x09, 0x4c, 0x5c, 0x02, 0xb5, 0x66, 0x5b, 0x6e, 0xb3, 0x17, 0x95, - 0x41, 0x95, 0xe4, 0xe2, 0xb5, 0x83, 0x5d, 0x12, 0xf5, 0xfb, 0xc7, 0xbf, 0xf0, 0xa8, 0x73, 0xc1, - 0x8b, 0xd7, 0x88, 0x30, 0x02, 0x42, 0xc9, 0x90, 0x50, 0x0d, 0x16, 0x82, 0xba, 0x24, 0xa5, 0x47, - 0x30, 0x2f, 0x3b, 0x44, 0xfd, 0x99,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ff, 0x3b, 0x30, 0x17, - 0xb4, 0x14, 0xff, 0x17, 0x65, 0x1e, 0x99, 0x6e, 0x3d, 0x77, 0xdd, 0x21, 0xb7, 0x1f, 0x80, 0x16, - 0x55, 0x04, 0xff, 0x3f, 0x19, 0x19, 0x19, 0x2b, 0x7d, 0x65, 0xba, 0x53, 0x1c, 0x55, 0xdd, 0xb9, - 0x1c, 0xe6, 0xd1, 0xb7, 0x61, 0x1e, 0x7d, 0x1f, 0xe6, 0xd1, 0xcf, 0x61, 0x1e, 0x7d, 0xfa, 0x95, - 0x8f, 0xbd, 0xba, 0x1f, 0x79, 0xf2, 0x2d, 0x36, 0x30, 0xcd, 0x52, 0x9b, 0x9e, 0x57, 0x2c, 0x6a, - 0x9f, 0xb0, 0x92, 0x78, 0xf0, 0xc5, 0x99, 0x2d, 0x85, 0x5b, 0x8f, 0xff, 0x04, 0x00, 0x00, 0xff, - 0xff, 0x37, 0xfc, 0x5a, 0x85, 0x7d, 0x08, 0x00, 0x00, + // 831 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x4f, 0xdb, 0x48, + 0x14, 0xce, 0x24, 0xc1, 0xc0, 0x8b, 0x03, 0x68, 0xc8, 0xb2, 0x91, 0x17, 0x05, 0x64, 0xa1, 0xdd, + 0xac, 0x56, 0x71, 0x58, 0x56, 0x02, 0x0e, 0x70, 0xd8, 0x24, 0x82, 0x70, 0x58, 0xc1, 0x1a, 0x84, + 0xd4, 0xde, 0x1c, 0x67, 0xf2, 0xa3, 0x04, 0x3b, 0xf5, 0xd8, 0x54, 0xfc, 0x01, 0x3d, 0xf7, 0xda, + 0x43, 0xff, 0x93, 0xf6, 0x0f, 0xe0, 0xc8, 0xb1, 0xea, 0x01, 0x55, 0xe9, 0xa9, 0x87, 0xde, 0x7b, + 0xac, 0xe6, 0x87, 0x63, 0x27, 0x14, 0xda, 0x72, 0x68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 0xff, 0xff, 0x56, 0x6d, 0x00, 0xd5, 0x19, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1459,11 +1350,30 @@ func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x18 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 { size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1473,12 +1383,7 @@ func (m *GetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if m.Epoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1579,6 +1484,30 @@ func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if m.R != nil { { size := m.R.Size() @@ -1662,12 +1591,7 @@ func (m *PutRequest_PutHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 - } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x18 + dAtA[i] = 0x12 } if m.Object != nil { { @@ -1679,12 +1603,7 @@ func (m *PutRequest_PutHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - } - if m.Epoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -1750,6 +1669,30 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if m.Token != nil { { size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) @@ -1760,12 +1703,7 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a - } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x20 + dAtA[i] = 0x1a } { size := m.OwnerID.Size() @@ -1776,7 +1714,7 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 { size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1786,12 +1724,7 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if m.Epoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1846,11 +1779,30 @@ func (m *HeadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x20 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if m.FullHeaders { i-- if m.FullHeaders { @@ -1859,7 +1811,7 @@ func (m *HeadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x18 + dAtA[i] = 0x10 } { size := m.Address.Size() @@ -1870,12 +1822,7 @@ func (m *HeadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if m.Epoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1942,17 +1889,41 @@ func (m *SearchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 + if m.QueryVersion != 0 { + i = encodeVarintService(dAtA, i, uint64(m.QueryVersion)) i-- - dAtA[i] = 0x28 + dAtA[i] = 0x18 } if len(m.Query) > 0 { i -= len(m.Query) copy(dAtA[i:], m.Query) i = encodeVarintService(dAtA, i, uint64(len(m.Query))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x12 } { size := m.ContainerID.Size() @@ -1963,17 +1934,7 @@ func (m *SearchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a - if m.Version != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Version)) - i-- - dAtA[i] = 0x10 - } - if m.Epoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -2042,11 +2003,30 @@ func (m *GetRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x20 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if len(m.Ranges) > 0 { for iNdEx := len(m.Ranges) - 1; iNdEx >= 0; iNdEx-- { { @@ -2058,7 +2038,7 @@ func (m *GetRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } } { @@ -2070,12 +2050,7 @@ func (m *GetRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if m.Epoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -2139,17 +2114,36 @@ func (m *GetRangeHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.TTL != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TTL)) - i-- - dAtA[i] = 0x28 + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if len(m.Salt) > 0 { i -= len(m.Salt) copy(dAtA[i:], m.Salt) i = encodeVarintService(dAtA, i, uint64(len(m.Salt))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } if len(m.Ranges) > 0 { for iNdEx := len(m.Ranges) - 1; iNdEx >= 0; iNdEx-- { @@ -2162,7 +2156,7 @@ func (m *GetRangeHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } } { @@ -2174,12 +2168,7 @@ func (m *GetRangeHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if m.Epoch != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Epoch)) - i-- - dAtA[i] = 0x8 - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -2241,14 +2230,12 @@ func (m *GetRequest) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovService(uint64(m.Epoch)) - } l = m.Address.Size() n += 1 + l + sovService(uint64(l)) - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2303,6 +2290,10 @@ func (m *PutRequest) Size() (n int) { if m.R != nil { n += m.R.Size() } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2339,16 +2330,10 @@ func (m *PutRequest_PutHeader) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovService(uint64(m.Epoch)) - } if m.Object != nil { l = m.Object.Size() n += 1 + l + sovService(uint64(l)) } - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } if m.Token != nil { l = m.Token.Size() n += 1 + l + sovService(uint64(l)) @@ -2379,20 +2364,18 @@ func (m *DeleteRequest) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovService(uint64(m.Epoch)) - } l = m.Address.Size() n += 1 + l + sovService(uint64(l)) l = m.OwnerID.Size() n += 1 + l + sovService(uint64(l)) - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } if m.Token != nil { l = m.Token.Size() n += 1 + l + sovService(uint64(l)) } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2417,17 +2400,15 @@ func (m *HeadRequest) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovService(uint64(m.Epoch)) - } l = m.Address.Size() n += 1 + l + sovService(uint64(l)) if m.FullHeaders { n += 2 } - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2456,21 +2437,19 @@ func (m *SearchRequest) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovService(uint64(m.Epoch)) - } - if m.Version != 0 { - n += 1 + sovService(uint64(m.Version)) - } l = m.ContainerID.Size() n += 1 + l + sovService(uint64(l)) l = len(m.Query) if l > 0 { n += 1 + l + sovService(uint64(l)) } - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) + if m.QueryVersion != 0 { + n += 1 + sovService(uint64(m.QueryVersion)) } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2501,9 +2480,6 @@ func (m *GetRangeRequest) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovService(uint64(m.Epoch)) - } l = m.Address.Size() n += 1 + l + sovService(uint64(l)) if len(m.Ranges) > 0 { @@ -2512,9 +2488,10 @@ func (m *GetRangeRequest) Size() (n int) { n += 1 + l + sovService(uint64(l)) } } - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2545,9 +2522,6 @@ func (m *GetRangeHashRequest) Size() (n int) { } var l int _ = l - if m.Epoch != 0 { - n += 1 + sovService(uint64(m.Epoch)) - } l = m.Address.Size() n += 1 + l + sovService(uint64(l)) if len(m.Ranges) > 0 { @@ -2560,9 +2534,10 @@ func (m *GetRangeHashRequest) Size() (n int) { if l > 0 { n += 1 + l + sovService(uint64(l)) } - if m.TTL != 0 { - n += 1 + sovService(uint64(m.TTL)) - } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2623,25 +2598,6 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } @@ -2674,11 +2630,11 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -2688,11 +2644,58 @@ func (m *GetRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -2937,6 +2940,72 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error { copy(v, dAtA[iNdEx:postIndex]) m.R = &PutRequest_Chunk{v} iNdEx = postIndex + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -2992,25 +3061,6 @@ func (m *PutRequest_PutHeader) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType) } @@ -3046,26 +3096,7 @@ func (m *PutRequest_PutHeader) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) - } - m.TTL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TTL |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) } @@ -3243,25 +3274,6 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } @@ -3294,7 +3306,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field OwnerID", wireType) } @@ -3327,26 +3339,7 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) - } - m.TTL = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TTL |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) } @@ -3382,6 +3375,72 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -3491,25 +3550,6 @@ func (m *HeadRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } @@ -3542,7 +3582,7 @@ func (m *HeadRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field FullHeaders", wireType) } @@ -3562,11 +3602,11 @@ func (m *HeadRequest) Unmarshal(dAtA []byte) error { } } m.FullHeaders = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -3576,11 +3616,58 @@ func (m *HeadRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -3726,44 +3813,6 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ContainerID", wireType) } @@ -3796,7 +3845,7 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) } @@ -3830,11 +3879,11 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { m.Query = []byte{} } iNdEx = postIndex - case 5: + case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field QueryVersion", wireType) } - m.TTL = 0 + m.QueryVersion = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -3844,11 +3893,77 @@ func (m *SearchRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + m.QueryVersion |= uint32(b&0x7F) << shift if b < 0x80 { break } } + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -3992,25 +4107,6 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } @@ -4043,7 +4139,7 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) } @@ -4077,11 +4173,11 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -4091,11 +4187,58 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -4237,25 +4380,6 @@ func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) - } - m.Epoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Epoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } @@ -4288,7 +4412,7 @@ func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) } @@ -4322,7 +4446,7 @@ func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType) } @@ -4356,11 +4480,11 @@ func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { m.Salt = []byte{} } iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) } - m.TTL = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -4370,11 +4494,58 @@ func (m *GetRangeHashRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TTL |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/object/service.proto b/object/service.proto index 7a971db..da54447 100644 --- a/object/service.proto +++ b/object/service.proto @@ -5,6 +5,8 @@ option go_package = "github.com/nspcc-dev/neofs-proto/object"; import "refs/types.proto"; import "object/types.proto"; import "session/types.proto"; +import "service/meta.proto"; +import "service/verify.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; @@ -52,14 +54,12 @@ service Service { } message GetRequest { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint64 Epoch = 1; // Address of object (container id + object id) - refs.Address Address = 2 [(gogoproto.nullable) = false]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 3; + refs.Address Address = 1 [(gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message GetResponse { @@ -73,16 +73,10 @@ message GetResponse { message PutRequest { message PutHeader { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint64 Epoch = 1; // Object with at least container id and owner id fields - Object Object = 2; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 3; + Object Object = 1; // Token with session public key and user's signature - session.Token Token = 4; + session.Token Token = 2; } oneof R { @@ -91,6 +85,11 @@ message PutRequest { // Chunk should be a remaining message in stream should be chunks bytes Chunk = 2; } + + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message PutResponse { @@ -98,18 +97,16 @@ message PutResponse { refs.Address Address = 1 [(gogoproto.nullable) = false]; } message DeleteRequest { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint64 Epoch = 1; // Address of object (container id + object id) - refs.Address Address = 2 [(gogoproto.nullable) = false]; + refs.Address Address = 1 [(gogoproto.nullable) = false]; // OwnerID is a wallet address - bytes OwnerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 4; + bytes OwnerID = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "OwnerID"]; // Token with session public key and user's signature - session.Token Token = 5; + session.Token Token = 3; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } // DeleteResponse is empty because we cannot guarantee permanent object removal @@ -117,16 +114,14 @@ message DeleteRequest { message DeleteResponse {} message HeadRequest { - // Epoch should be empty on user side, node sets epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint64 Epoch = 1; // Address of object (container id + object id) - refs.Address Address = 2 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; + refs.Address Address = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "Address"]; // FullHeaders can be set true for extended headers in the object - bool FullHeaders = 3; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 4; + bool FullHeaders = 2; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message HeadResponse { // Object without payload @@ -134,18 +129,16 @@ message HeadResponse { } message SearchRequest { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint64 Epoch = 1; - // Version of search query format - uint32 Version = 2; // ContainerID for searching the object - bytes ContainerID = 3 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"]; + bytes ContainerID = 1 [(gogoproto.nullable) = false, (gogoproto.customtype) = "CID"]; // Query in the binary serialized format - bytes Query = 4; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 5; + bytes Query = 2; + // QueryVersion is a version of search query format + uint32 QueryVersion = 3; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message SearchResponse { @@ -154,16 +147,14 @@ message SearchResponse { } message GetRangeRequest { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint64 Epoch = 1; // Address of object (container id + object id) - refs.Address Address = 2 [(gogoproto.nullable) = false]; + refs.Address Address = 1 [(gogoproto.nullable) = false]; // Ranges of object's payload to return - repeated Range Ranges = 3 [(gogoproto.nullable) = false]; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 4; + repeated Range Ranges = 2 [(gogoproto.nullable) = false]; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message GetRangeResponse { @@ -172,18 +163,16 @@ message GetRangeResponse { } message GetRangeHashRequest { - // Epoch is set by user to 0, node set epoch to the actual value - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint64 Epoch = 1; // Address of object (container id + object id) - refs.Address Address = 2 [(gogoproto.nullable) = false]; + refs.Address Address = 1 [(gogoproto.nullable) = false]; // Ranges of object's payload to calculate homomorphic hash - repeated Range Ranges = 3 [(gogoproto.nullable) = false]; + repeated Range Ranges = 2 [(gogoproto.nullable) = false]; // Salt is used to XOR object's payload ranges before hashing, it can be nil - bytes Salt = 4; - // TTL must be larger than zero, it decreased in every neofs-node - // Deprecated: will be replaced with RequestMetaHeader (see develop branch) - uint32 TTL = 5; + bytes Salt = 3; + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message GetRangeHashResponse { diff --git a/object/utils.go b/object/utils.go index 1799b24..f74fa2f 100644 --- a/object/utils.go +++ b/object/utils.go @@ -4,6 +4,7 @@ import ( "io" "code.cloudfoundry.org/bytefmt" + "github.com/nspcc-dev/neofs-proto/service" "github.com/nspcc-dev/neofs-proto/session" "github.com/pkg/errors" ) @@ -49,14 +50,11 @@ func SendPutRequest(s Service_PutClient, obj *Object, epoch uint64, ttl uint32) // into header of object put request. func MakePutRequestHeader(obj *Object, epoch uint64, ttl uint32, token *session.Token) *PutRequest { return &PutRequest{ - R: &PutRequest_Header{ - Header: &PutRequest_PutHeader{ - Epoch: epoch, - Object: obj, - TTL: ttl, - Token: token, - }, - }, + RequestMetaHeader: service.RequestMetaHeader{TTL: ttl, Epoch: epoch}, + R: &PutRequest_Header{Header: &PutRequest_PutHeader{ + Object: obj, + Token: token, + }}, } } diff --git a/service/meta.go b/service/meta.go new file mode 100644 index 0000000..6b5b8b7 --- /dev/null +++ b/service/meta.go @@ -0,0 +1,111 @@ +package service + +import ( + "github.com/nspcc-dev/neofs-proto/internal" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ( + // MetaHeader contains meta information of request. + // It provides methods to get or set meta information meta header. + // Also contains methods to reset and restore meta header. + // Also contains methods to get or set request protocol version + MetaHeader interface { + ResetMeta() RequestMetaHeader + RestoreMeta(RequestMetaHeader) + + // TTLRequest to verify and update ttl requests. + GetTTL() uint32 + SetTTL(uint32) + + // EpochRequest gives possibility to get or set epoch in RPC Requests. + GetEpoch() uint64 + SetEpoch(uint64) + + // VersionHeader allows get or set version of protocol request + VersionHeader + } + + // VersionHeader allows get or set version of protocol request + VersionHeader interface { + GetVersion() uint32 + SetVersion(uint32) + } + + // TTLCondition is closure, that allows to validate request with ttl. + TTLCondition func(ttl uint32) error +) + +const ( + // ZeroTTL is empty ttl, should produce ErrZeroTTL. + ZeroTTL = iota + + // NonForwardingTTL is a ttl that allows direct connections only. + NonForwardingTTL + + // SingleForwardingTTL is a ttl that allows connections through another node. + SingleForwardingTTL +) + +const ( + // ErrZeroTTL is raised when zero ttl is passed. + ErrZeroTTL = internal.Error("zero ttl") + + // ErrIncorrectTTL is raised when NonForwardingTTL is passed and NodeRole != InnerRingNode. + ErrIncorrectTTL = internal.Error("incorrect ttl") +) + +// SetVersion sets protocol version to RequestMetaHeader. +func (m *RequestMetaHeader) SetVersion(v uint32) { m.Version = v } + +// SetTTL sets TTL to RequestMetaHeader. +func (m *RequestMetaHeader) SetTTL(v uint32) { m.TTL = v } + +// SetEpoch sets Epoch to RequestMetaHeader. +func (m *RequestMetaHeader) SetEpoch(v uint64) { m.Epoch = v } + +// ResetMeta returns current value and sets RequestMetaHeader to empty value. +func (m *RequestMetaHeader) ResetMeta() RequestMetaHeader { + cp := *m + m.Reset() + return cp +} + +// RestoreMeta sets current RequestMetaHeader to passed value. +func (m *RequestMetaHeader) RestoreMeta(v RequestMetaHeader) { *m = v } + +// IRNonForwarding condition that allows NonForwardingTTL only for IR +func IRNonForwarding(role NodeRole) TTLCondition { + return func(ttl uint32) error { + if ttl == NonForwardingTTL && role != InnerRingNode { + return ErrIncorrectTTL + } + + return nil + } +} + +// ProcessRequestTTL validates and update ttl requests. +func ProcessRequestTTL(req MetaHeader, cond ...TTLCondition) error { + var ttl = req.GetTTL() + + if ttl == ZeroTTL { + return status.New(codes.InvalidArgument, ErrZeroTTL.Error()).Err() + } + + for i := range cond { + if cond[i] == nil { + continue + } + + // check specific condition: + if err := cond[i](ttl); err != nil { + return status.New(codes.InvalidArgument, err.Error()).Err() + } + } + + req.SetTTL(ttl - 1) + + return nil +} diff --git a/service/meta.pb.go b/service/meta.pb.go new file mode 100644 index 0000000..d5f58fd --- /dev/null +++ b/service/meta.pb.go @@ -0,0 +1,388 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: service/meta.proto + +package service + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// 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 + +// RequestMetaHeader contains information about request meta headers +// (should be embedded into message) +type RequestMetaHeader struct { + // TTL must be larger than zero, it decreased in every NeoFS Node + TTL uint32 `protobuf:"varint,1,opt,name=TTL,proto3" json:"TTL,omitempty"` + // Epoch for user can be empty, because node sets epoch to the actual value + Epoch uint64 `protobuf:"varint,2,opt,name=Epoch,proto3" json:"Epoch,omitempty"` + // Version defines protocol version + // TODO: not used for now, should be implemented in future + Version uint32 `protobuf:"varint,3,opt,name=Version,proto3" json:"Version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestMetaHeader) Reset() { *m = RequestMetaHeader{} } +func (m *RequestMetaHeader) String() string { return proto.CompactTextString(m) } +func (*RequestMetaHeader) ProtoMessage() {} +func (*RequestMetaHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_a638867e7b43457c, []int{0} +} +func (m *RequestMetaHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestMetaHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *RequestMetaHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestMetaHeader.Merge(m, src) +} +func (m *RequestMetaHeader) XXX_Size() int { + return m.Size() +} +func (m *RequestMetaHeader) XXX_DiscardUnknown() { + xxx_messageInfo_RequestMetaHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestMetaHeader proto.InternalMessageInfo + +func (m *RequestMetaHeader) GetTTL() uint32 { + if m != nil { + return m.TTL + } + return 0 +} + +func (m *RequestMetaHeader) GetEpoch() uint64 { + if m != nil { + return m.Epoch + } + return 0 +} + +func (m *RequestMetaHeader) GetVersion() uint32 { + if m != nil { + return m.Version + } + return 0 +} + +func init() { + proto.RegisterType((*RequestMetaHeader)(nil), "service.RequestMetaHeader") +} + +func init() { proto.RegisterFile("service/meta.proto", fileDescriptor_a638867e7b43457c) } + +var fileDescriptor_a638867e7b43457c = []byte{ + // 202 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4e, 0x2d, 0x2a, + 0xcb, 0x4c, 0x4e, 0xd5, 0xcf, 0x4d, 0x2d, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, + 0x87, 0x8a, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, + 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0xe5, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0xe8, + 0x53, 0x0a, 0xe5, 0x12, 0x0c, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0xf1, 0x4d, 0x2d, 0x49, 0xf4, + 0x48, 0x4d, 0x4c, 0x49, 0x2d, 0x12, 0x12, 0xe0, 0x62, 0x0e, 0x09, 0xf1, 0x91, 0x60, 0x54, 0x60, + 0xd4, 0xe0, 0x0d, 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0x5d, 0x0b, 0xf2, 0x93, 0x33, 0x24, 0x98, + 0x14, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, 0x21, 0x09, 0x2e, 0xf6, 0xb0, 0xd4, 0xa2, 0xe2, 0xcc, + 0xfc, 0x3c, 0x09, 0x66, 0xb0, 0x5a, 0x18, 0xd7, 0xc9, 0xee, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, + 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x28, + 0x0d, 0x24, 0xb7, 0xe5, 0x15, 0x17, 0x24, 0x27, 0xeb, 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0xe6, + 0xa7, 0x15, 0xeb, 0x42, 0x5c, 0x06, 0xf5, 0x45, 0x12, 0x1b, 0x98, 0x6b, 0x0c, 0x08, 0x00, 0x00, + 0xff, 0xff, 0x6b, 0x83, 0x1d, 0xcf, 0xeb, 0x00, 0x00, 0x00, +} + +func (m *RequestMetaHeader) 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 *RequestMetaHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestMetaHeader) 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.Version != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x18 + } + if m.Epoch != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.Epoch)) + i-- + dAtA[i] = 0x10 + } + if m.TTL != 0 { + i = encodeVarintMeta(dAtA, i, uint64(m.TTL)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintMeta(dAtA []byte, offset int, v uint64) int { + offset -= sovMeta(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RequestMetaHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TTL != 0 { + n += 1 + sovMeta(uint64(m.TTL)) + } + if m.Epoch != 0 { + n += 1 + sovMeta(uint64(m.Epoch)) + } + if m.Version != 0 { + n += 1 + sovMeta(uint64(m.Version)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovMeta(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozMeta(x uint64) (n int) { + return sovMeta(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RequestMetaHeader) 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 ErrIntOverflowMeta + } + 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: RequestMetaHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestMetaHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TTL", wireType) + } + m.TTL = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TTL |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType) + } + m.Epoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Epoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMeta + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMeta + } + 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 skipMeta(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, ErrIntOverflowMeta + } + 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, ErrIntOverflowMeta + } + 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, ErrIntOverflowMeta + } + 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, ErrInvalidLengthMeta + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMeta + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthMeta + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthMeta = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMeta = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMeta = fmt.Errorf("proto: unexpected end of group") +) diff --git a/service/meta.proto b/service/meta.proto new file mode 100644 index 0000000..d3c3005 --- /dev/null +++ b/service/meta.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; +package service; +option go_package = "github.com/nspcc-dev/neofs-proto/service"; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +// RequestMetaHeader contains information about request meta headers +// (should be embedded into message) +message RequestMetaHeader { + // TTL must be larger than zero, it decreased in every NeoFS Node + uint32 TTL = 1; + // Epoch for user can be empty, because node sets epoch to the actual value + uint64 Epoch = 2; + // Version defines protocol version + // TODO: not used for now, should be implemented in future + uint32 Version = 3; +} diff --git a/service/meta_test.go b/service/meta_test.go new file mode 100644 index 0000000..893ca5e --- /dev/null +++ b/service/meta_test.go @@ -0,0 +1,70 @@ +package service + +import ( + "testing" + + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type mockedRequest struct { + msg string + name string + role NodeRole + code codes.Code + RequestMetaHeader +} + +func TestMetaRequest(t *testing.T) { + tests := []mockedRequest{ + { + role: InnerRingNode, + name: "direct to ir node", + RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL}, + }, + { + role: StorageNode, + code: codes.InvalidArgument, + msg: ErrIncorrectTTL.Error(), + name: "direct to storage node", + RequestMetaHeader: RequestMetaHeader{TTL: NonForwardingTTL}, + }, + { + role: StorageNode, + msg: ErrZeroTTL.Error(), + code: codes.InvalidArgument, + name: "zero ttl", + RequestMetaHeader: RequestMetaHeader{TTL: ZeroTTL}, + }, + { + role: InnerRingNode, + name: "default to ir node", + RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, + }, + { + role: StorageNode, + name: "default to storage node", + RequestMetaHeader: RequestMetaHeader{TTL: SingleForwardingTTL}, + }, + } + + for i := range tests { + tt := tests[i] + t.Run(tt.name, func(t *testing.T) { + before := tt.GetTTL() + err := ProcessRequestTTL(&tt, IRNonForwarding(tt.role)) + if tt.msg != "" { + require.Errorf(t, err, tt.msg) + + state, ok := status.FromError(err) + require.True(t, ok) + require.Equal(t, state.Code(), tt.code) + require.Equal(t, state.Message(), tt.msg) + } else { + require.NoError(t, err) + require.NotEqualf(t, before, tt.GetTTL(), "ttl should be changed: %d vs %d", before, tt.GetTTL()) + } + }) + } +} diff --git a/service/role_test.go b/service/role_test.go index a1f1cc0..01dbee2 100644 --- a/service/role_test.go +++ b/service/role_test.go @@ -1,8 +1,9 @@ package service import ( - "github.com/stretchr/testify/require" "testing" + + "github.com/stretchr/testify/require" ) func TestNodeRole_String(t *testing.T) { diff --git a/service/ttl.go b/service/ttl.go deleted file mode 100644 index 8ddf1de..0000000 --- a/service/ttl.go +++ /dev/null @@ -1,45 +0,0 @@ -package service - -import ( - "github.com/nspcc-dev/neofs-proto/internal" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// TTLRequest to verify and update ttl requests. -type TTLRequest interface { - GetTTL() uint32 - SetTTL(uint32) -} - -const ( - // ZeroTTL is empty ttl, should produce ErrZeroTTL. - ZeroTTL = iota - - // NonForwardingTTL is a ttl that allows direct connections only. - NonForwardingTTL - - // SingleForwardingTTL is a ttl that allows connections through another node. - SingleForwardingTTL - - // ErrZeroTTL is raised when zero ttl is passed. - ErrZeroTTL = internal.Error("zero ttl") - - // ErrIncorrectTTL is raised when NonForwardingTTL is passed and NodeRole != InnerRingNode. - ErrIncorrectTTL = internal.Error("incorrect ttl") -) - -// CheckTTLRequest validates and update ttl requests. -func CheckTTLRequest(req TTLRequest, role NodeRole) error { - var ttl = req.GetTTL() - - if ttl == ZeroTTL { - return status.New(codes.InvalidArgument, ErrZeroTTL.Error()).Err() - } else if ttl == NonForwardingTTL && role != InnerRingNode { - return status.New(codes.InvalidArgument, ErrIncorrectTTL.Error()).Err() - } - - req.SetTTL(ttl - 1) - - return nil -} diff --git a/service/ttl_test.go b/service/ttl_test.go deleted file mode 100644 index 1349198..0000000 --- a/service/ttl_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package service - -import ( - "github.com/stretchr/testify/require" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "testing" -) - -type mockedRequest struct { - msg string - ttl uint32 - name string - role NodeRole - code codes.Code -} - -func (m *mockedRequest) SetTTL(v uint32) { m.ttl = v } -func (m mockedRequest) GetTTL() uint32 { return m.ttl } - -func TestCheckTTLRequest(t *testing.T) { - tests := []mockedRequest{ - { - ttl: NonForwardingTTL, - role: InnerRingNode, - name: "direct to ir node", - }, - { - ttl: NonForwardingTTL, - role: StorageNode, - code: codes.InvalidArgument, - msg: ErrIncorrectTTL.Error(), - name: "direct to storage node", - }, - { - ttl: ZeroTTL, - role: StorageNode, - msg: ErrZeroTTL.Error(), - code: codes.InvalidArgument, - name: "zero ttl", - }, - { - ttl: SingleForwardingTTL, - role: InnerRingNode, - name: "default to ir node", - }, - { - ttl: SingleForwardingTTL, - role: StorageNode, - name: "default to storage node", - }, - } - - for i := range tests { - tt := tests[i] - t.Run(tt.name, func(t *testing.T) { - before := tt.ttl - err := CheckTTLRequest(&tt, tt.role) - if tt.msg != "" { - require.Errorf(t, err, tt.msg) - - state, ok := status.FromError(err) - require.True(t, ok) - require.Equal(t, state.Code(), tt.code) - require.Equal(t, state.Message(), tt.msg) - } else { - require.NoError(t, err) - require.NotEqualf(t, before, tt.ttl, "ttl should be changed: %d vs %d", before, tt.ttl) - } - }) - } -} diff --git a/service/verify.go b/service/verify.go new file mode 100644 index 0000000..a6ac3a5 --- /dev/null +++ b/service/verify.go @@ -0,0 +1,219 @@ +package service + +import ( + "crypto/ecdsa" + + "github.com/gogo/protobuf/proto" + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-proto/internal" + "github.com/pkg/errors" +) + +type ( + // VerifiableRequest adds possibility to sign and verify request header. + VerifiableRequest interface { + proto.Message + Marshal() ([]byte, error) + AddSignature(*RequestVerificationHeader_Signature) + GetSignatures() []*RequestVerificationHeader_Signature + SetSignatures([]*RequestVerificationHeader_Signature) + } + + // MaintainableRequest adds possibility to set and get (+validate) + // owner (client) public key from RequestVerificationHeader. + MaintainableRequest interface { + proto.Message + GetOwner() (*ecdsa.PublicKey, error) + SetOwner(*ecdsa.PublicKey, []byte) + GetLastPeer() (*ecdsa.PublicKey, error) + } +) + +const ( + // ErrCannotLoadPublicKey is raised when cannot unmarshal public key from RequestVerificationHeader_Sign. + ErrCannotLoadPublicKey = internal.Error("cannot load public key") + + // ErrCannotFindOwner is raised when signatures empty in GetOwner. + ErrCannotFindOwner = internal.Error("cannot find owner public key") +) + +// SetSignatures replaces signatures stored in RequestVerificationHeader. +func (m *RequestVerificationHeader) SetSignatures(signatures []*RequestVerificationHeader_Signature) { + m.Signatures = signatures +} + +// AddSignature adds new Signature into RequestVerificationHeader. +func (m *RequestVerificationHeader) AddSignature(sig *RequestVerificationHeader_Signature) { + if sig == nil { + return + } + m.Signatures = append(m.Signatures, sig) +} + +// SetOwner adds origin (sign and public key) of owner (client) into first signature. +func (m *RequestVerificationHeader) SetOwner(pub *ecdsa.PublicKey, sign []byte) { + if len(m.Signatures) == 0 || pub == nil { + return + } + + m.Signatures[0].Origin = &RequestVerificationHeader_Sign{ + Sign: sign, + Peer: crypto.MarshalPublicKey(pub), + } +} + +// GetOwner tries to get owner (client) public key from signatures. +// If signatures contains not empty Origin, we should try to validate, +// that session key was signed by owner (client), otherwise return error. +func (m *RequestVerificationHeader) GetOwner() (*ecdsa.PublicKey, error) { + if len(m.Signatures) == 0 { + return nil, ErrCannotFindOwner + } + + // if first signature contains origin, we should try to validate session key + if m.Signatures[0].Origin != nil { + owner := crypto.UnmarshalPublicKey(m.Signatures[0].Origin.Peer) + if owner == nil { + return nil, ErrCannotLoadPublicKey + } else if err := crypto.Verify(owner, m.Signatures[0].Peer, m.Signatures[0].Origin.Sign); err != nil { + return nil, errors.Wrap(err, "could not verify session token") + } + + return owner, nil + } else if key := crypto.UnmarshalPublicKey(m.Signatures[0].Peer); key != nil { + return key, nil + } + + return nil, ErrCannotLoadPublicKey +} + +// GetLastPeer tries to get last peer public key from signatures. +// If signatures has zero length, returns ErrCannotFindOwner. +// If signatures has length equal to one, uses GetOwner. +// Otherwise tries to unmarshal last peer public key. +func (m *RequestVerificationHeader) GetLastPeer() (*ecdsa.PublicKey, error) { + switch ln := len(m.Signatures); ln { + case 0: + return nil, ErrCannotFindOwner + case 1: + return m.GetOwner() + default: + if key := crypto.UnmarshalPublicKey(m.Signatures[ln-1].Peer); key != nil { + return key, nil + } + + return nil, ErrCannotLoadPublicKey + } +} + +func newSignature(key *ecdsa.PrivateKey, data []byte) (*RequestVerificationHeader_Signature, error) { + sign, err := crypto.Sign(key, data) + if err != nil { + return nil, err + } + + return &RequestVerificationHeader_Signature{ + RequestVerificationHeader_Sign: RequestVerificationHeader_Sign{ + Sign: sign, + Peer: crypto.MarshalPublicKey(&key.PublicKey), + }, + }, nil +} + +// SignRequestHeader receives private key and request with RequestVerificationHeader, +// tries to marshal and sign request with passed PrivateKey, after that adds +// new signature to headers. If something went wrong, returns error. +func SignRequestHeader(key *ecdsa.PrivateKey, msg VerifiableRequest) error { + // ignore meta header + if meta, ok := msg.(MetaHeader); ok { + h := meta.ResetMeta() + + defer func() { + meta.RestoreMeta(h) + }() + } + + data, err := msg.Marshal() + if err != nil { + return err + } + + signature, err := newSignature(key, data) + if err != nil { + return err + } + + msg.AddSignature(signature) + + return nil +} + +// VerifyRequestHeader receives request with RequestVerificationHeader, +// tries to marshal and verify each signature from request. +// If something went wrong, returns error. +func VerifyRequestHeader(msg VerifiableRequest) error { + // ignore meta header + if meta, ok := msg.(MetaHeader); ok { + h := meta.ResetMeta() + + defer func() { + meta.RestoreMeta(h) + }() + } + + signatures := msg.GetSignatures() + defer func() { + msg.SetSignatures(signatures) + }() + + for i := range signatures { + msg.SetSignatures(signatures[:i]) + peer := signatures[i].GetPeer() + sign := signatures[i].GetSign() + + key := crypto.UnmarshalPublicKey(peer) + if key == nil { + return errors.Wrapf(ErrCannotLoadPublicKey, "%d: %02x", i, peer) + } + + if data, err := msg.Marshal(); err != nil { + return errors.Wrapf(err, "%d: %02x", i, peer) + } else if err := crypto.Verify(key, data, sign); err != nil { + return errors.Wrapf(err, "%d: %02x", i, peer) + } + } + + return nil +} + +// testCustomField for test usage only. +type testCustomField [8]uint32 + +var _ internal.Custom = (*testCustomField)(nil) + +// Reset skip, it's for test usage only. +func (t testCustomField) Reset() {} + +// ProtoMessage skip, it's for test usage only. +func (t testCustomField) ProtoMessage() {} + +// Size skip, it's for test usage only. +func (t testCustomField) Size() int { return 32 } + +// String skip, it's for test usage only. +func (t testCustomField) String() string { return "" } + +// Bytes skip, it's for test usage only. +func (t testCustomField) Bytes() []byte { return nil } + +// Unmarshal skip, it's for test usage only. +func (t testCustomField) Unmarshal(data []byte) error { return nil } + +// Empty skip, it's for test usage only. +func (t testCustomField) Empty() bool { return false } + +// UnmarshalTo skip, it's for test usage only. +func (t testCustomField) MarshalTo(data []byte) (int, error) { return 0, nil } + +// Marshal skip, it's for test usage only. +func (t testCustomField) Marshal() ([]byte, error) { return nil, nil } diff --git a/service/verify.pb.go b/service/verify.pb.go new file mode 100644 index 0000000..95a9452 --- /dev/null +++ b/service/verify.pb.go @@ -0,0 +1,822 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: service/verify.proto + +package service + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// 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 + +// RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request +// (should be embedded into message). +type RequestVerificationHeader struct { + // Signatures is a set of signatures of every passed NeoFS Node + Signatures []*RequestVerificationHeader_Signature `protobuf:"bytes,1,rep,name=Signatures,proto3" json:"Signatures,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestVerificationHeader) Reset() { *m = RequestVerificationHeader{} } +func (m *RequestVerificationHeader) String() string { return proto.CompactTextString(m) } +func (*RequestVerificationHeader) ProtoMessage() {} +func (*RequestVerificationHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_4bdd5bc50ec96238, []int{0} +} +func (m *RequestVerificationHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestVerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *RequestVerificationHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestVerificationHeader.Merge(m, src) +} +func (m *RequestVerificationHeader) XXX_Size() int { + return m.Size() +} +func (m *RequestVerificationHeader) XXX_DiscardUnknown() { + xxx_messageInfo_RequestVerificationHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestVerificationHeader proto.InternalMessageInfo + +func (m *RequestVerificationHeader) GetSignatures() []*RequestVerificationHeader_Signature { + if m != nil { + return m.Signatures + } + return nil +} + +type RequestVerificationHeader_Sign struct { + // Sign is signature of the request or session key. + Sign []byte `protobuf:"bytes,1,opt,name=Sign,proto3" json:"Sign,omitempty"` + // Peer is compressed public key used for signature. + Peer []byte `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestVerificationHeader_Sign) Reset() { *m = RequestVerificationHeader_Sign{} } +func (m *RequestVerificationHeader_Sign) String() string { return proto.CompactTextString(m) } +func (*RequestVerificationHeader_Sign) ProtoMessage() {} +func (*RequestVerificationHeader_Sign) Descriptor() ([]byte, []int) { + return fileDescriptor_4bdd5bc50ec96238, []int{0, 0} +} +func (m *RequestVerificationHeader_Sign) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestVerificationHeader_Sign) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *RequestVerificationHeader_Sign) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestVerificationHeader_Sign.Merge(m, src) +} +func (m *RequestVerificationHeader_Sign) XXX_Size() int { + return m.Size() +} +func (m *RequestVerificationHeader_Sign) XXX_DiscardUnknown() { + xxx_messageInfo_RequestVerificationHeader_Sign.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestVerificationHeader_Sign proto.InternalMessageInfo + +func (m *RequestVerificationHeader_Sign) GetSign() []byte { + if m != nil { + return m.Sign + } + return nil +} + +func (m *RequestVerificationHeader_Sign) GetPeer() []byte { + if m != nil { + return m.Peer + } + return nil +} + +type RequestVerificationHeader_Signature struct { + // Sign is a signature and public key of the request. + RequestVerificationHeader_Sign `protobuf:"bytes,1,opt,name=Sign,proto3,embedded=Sign" json:"Sign"` + // Origin used for requests, when trusted node changes it and re-sign with session key. + // If session key used for signature request, then Origin should contain + // public key of user and signed session key. + Origin *RequestVerificationHeader_Sign `protobuf:"bytes,2,opt,name=Origin,proto3" json:"Origin,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestVerificationHeader_Signature) Reset() { *m = RequestVerificationHeader_Signature{} } +func (m *RequestVerificationHeader_Signature) String() string { return proto.CompactTextString(m) } +func (*RequestVerificationHeader_Signature) ProtoMessage() {} +func (*RequestVerificationHeader_Signature) Descriptor() ([]byte, []int) { + return fileDescriptor_4bdd5bc50ec96238, []int{0, 1} +} +func (m *RequestVerificationHeader_Signature) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestVerificationHeader_Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *RequestVerificationHeader_Signature) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestVerificationHeader_Signature.Merge(m, src) +} +func (m *RequestVerificationHeader_Signature) XXX_Size() int { + return m.Size() +} +func (m *RequestVerificationHeader_Signature) XXX_DiscardUnknown() { + xxx_messageInfo_RequestVerificationHeader_Signature.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestVerificationHeader_Signature proto.InternalMessageInfo + +func (m *RequestVerificationHeader_Signature) GetOrigin() *RequestVerificationHeader_Sign { + if m != nil { + return m.Origin + } + return nil +} + +func init() { + proto.RegisterType((*RequestVerificationHeader)(nil), "service.RequestVerificationHeader") + proto.RegisterType((*RequestVerificationHeader_Sign)(nil), "service.RequestVerificationHeader.Sign") + proto.RegisterType((*RequestVerificationHeader_Signature)(nil), "service.RequestVerificationHeader.Signature") +} + +func init() { proto.RegisterFile("service/verify.proto", fileDescriptor_4bdd5bc50ec96238) } + +var fileDescriptor_4bdd5bc50ec96238 = []byte{ + // 270 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x4e, 0x2d, 0x2a, + 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x4b, 0x2d, 0xca, 0x4c, 0xab, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0x62, 0x87, 0x8a, 0x4a, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, + 0xea, 0xa7, 0xe7, 0xa7, 0xe7, 0xeb, 0x83, 0xe5, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, + 0x82, 0xe8, 0x53, 0x5a, 0xcf, 0xc4, 0x25, 0x19, 0x94, 0x5a, 0x58, 0x9a, 0x5a, 0x5c, 0x12, 0x06, + 0x32, 0x2f, 0x33, 0x39, 0xb1, 0x24, 0x33, 0x3f, 0xcf, 0x23, 0x35, 0x31, 0x25, 0xb5, 0x48, 0xc8, + 0x87, 0x8b, 0x2b, 0x38, 0x33, 0x3d, 0x2f, 0xb1, 0xa4, 0xb4, 0x28, 0xb5, 0x58, 0x82, 0x51, 0x81, + 0x59, 0x83, 0xdb, 0x48, 0x47, 0x0f, 0x6a, 0x95, 0x1e, 0x4e, 0x7d, 0x7a, 0x70, 0x4d, 0x41, 0x48, + 0xfa, 0xa5, 0xf4, 0xb8, 0x58, 0x40, 0x3c, 0x21, 0x21, 0x08, 0x2d, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, + 0x13, 0x04, 0x17, 0x0b, 0x48, 0x4d, 0x2d, 0x92, 0x60, 0x82, 0x88, 0x81, 0xd8, 0x52, 0x93, 0x19, + 0xb9, 0x38, 0xe1, 0xda, 0x85, 0x5c, 0x91, 0x74, 0x71, 0x1b, 0xa9, 0x13, 0xe9, 0x0a, 0x27, 0x8e, + 0x13, 0xf7, 0xe4, 0x19, 0x2e, 0xdc, 0x93, 0x67, 0x84, 0x5a, 0x64, 0xcf, 0xc5, 0xe6, 0x5f, 0x94, + 0x99, 0x9e, 0x99, 0x07, 0xb6, 0x8a, 0x78, 0x83, 0x82, 0xa0, 0xda, 0x9c, 0xec, 0x4e, 0x3c, 0x92, + 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc6, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x67, 0x3c, + 0x96, 0x63, 0x88, 0xd2, 0x40, 0x0a, 0xf6, 0xbc, 0xe2, 0x82, 0xe4, 0x64, 0xdd, 0x94, 0xd4, 0x32, + 0xfd, 0xbc, 0xd4, 0xfc, 0xb4, 0x62, 0x5d, 0x48, 0xa0, 0x43, 0xad, 0x49, 0x62, 0x03, 0x73, 0x8d, + 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd7, 0x15, 0xf6, 0x5e, 0xc8, 0x01, 0x00, 0x00, +} + +func (m *RequestVerificationHeader) 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 *RequestVerificationHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestVerificationHeader) 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.Signatures) > 0 { + for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *RequestVerificationHeader_Sign) 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 *RequestVerificationHeader_Sign) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestVerificationHeader_Sign) 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.Peer) > 0 { + i -= len(m.Peer) + copy(dAtA[i:], m.Peer) + i = encodeVarintVerify(dAtA, i, uint64(len(m.Peer))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sign) > 0 { + i -= len(m.Sign) + copy(dAtA[i:], m.Sign) + i = encodeVarintVerify(dAtA, i, uint64(len(m.Sign))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RequestVerificationHeader_Signature) 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 *RequestVerificationHeader_Signature) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestVerificationHeader_Signature) 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.Origin != nil { + { + size, err := m.Origin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size, err := m.RequestVerificationHeader_Sign.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerify(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintVerify(dAtA []byte, offset int, v uint64) int { + offset -= sovVerify(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RequestVerificationHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Signatures) > 0 { + for _, e := range m.Signatures { + l = e.Size() + n += 1 + l + sovVerify(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RequestVerificationHeader_Sign) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sign) + if l > 0 { + n += 1 + l + sovVerify(uint64(l)) + } + l = len(m.Peer) + if l > 0 { + n += 1 + l + sovVerify(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RequestVerificationHeader_Signature) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.RequestVerificationHeader_Sign.Size() + n += 1 + l + sovVerify(uint64(l)) + if m.Origin != nil { + l = m.Origin.Size() + n += 1 + l + sovVerify(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovVerify(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozVerify(x uint64) (n int) { + return sovVerify(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RequestVerificationHeader) 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 ErrIntOverflowVerify + } + 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: RequestVerificationHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestVerificationHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signatures = append(m.Signatures, &RequestVerificationHeader_Signature{}) + if err := m.Signatures[len(m.Signatures)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVerify(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerify + } + 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 (m *RequestVerificationHeader_Sign) 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 ErrIntOverflowVerify + } + 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: Sign: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sign: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sign", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sign = append(m.Sign[:0], dAtA[iNdEx:postIndex]...) + if m.Sign == nil { + m.Sign = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Peer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Peer = append(m.Peer[:0], dAtA[iNdEx:postIndex]...) + if m.Peer == nil { + m.Peer = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVerify(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerify + } + 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 (m *RequestVerificationHeader_Signature) 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 ErrIntOverflowVerify + } + 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: Signature: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader_Sign", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader_Sign.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerify + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerify + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerify + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Origin == nil { + m.Origin = &RequestVerificationHeader_Sign{} + } + if err := m.Origin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVerify(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerify + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerify + } + 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 skipVerify(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, ErrIntOverflowVerify + } + 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, ErrIntOverflowVerify + } + 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, ErrIntOverflowVerify + } + 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, ErrInvalidLengthVerify + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupVerify + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthVerify + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthVerify = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowVerify = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupVerify = fmt.Errorf("proto: unexpected end of group") +) diff --git a/service/verify.proto b/service/verify.proto new file mode 100644 index 0000000..c70015b --- /dev/null +++ b/service/verify.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package service; +option go_package = "github.com/nspcc-dev/neofs-proto/service"; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +// RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request +// (should be embedded into message). +message RequestVerificationHeader { + message Sign { + // Sign is signature of the request or session key. + bytes Sign = 1; + // Peer is compressed public key used for signature. + bytes Peer = 2; + } + + message Signature { + // Sign is a signature and public key of the request. + Sign Sign = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // Origin used for requests, when trusted node changes it and re-sign with session key. + // If session key used for signature request, then Origin should contain + // public key of user and signed session key. + Sign Origin = 2; + } + + // Signatures is a set of signatures of every passed NeoFS Node + repeated Signature Signatures = 1; +} diff --git a/service/verify_test.go b/service/verify_test.go new file mode 100644 index 0000000..1403c67 --- /dev/null +++ b/service/verify_test.go @@ -0,0 +1,143 @@ +package service + +import ( + "bytes" + "log" + "math" + "testing" + + "github.com/gogo/protobuf/proto" + crypto "github.com/nspcc-dev/neofs-crypto" + "github.com/nspcc-dev/neofs-crypto/test" + "github.com/pkg/errors" + "github.com/stretchr/testify/require" +) + +func TestSignRequestHeader(t *testing.T) { + req := &TestRequest{ + IntField: math.MaxInt32, + StringField: "TestRequestStringField", + BytesField: []byte("TestRequestBytesField"), + } + + key := test.DecodeKey(0) + peer := crypto.MarshalPublicKey(&key.PublicKey) + + data, err := req.Marshal() + require.NoError(t, err) + + require.NoError(t, SignRequestHeader(key, req)) + + require.Len(t, req.Signatures, 1) + for i := range req.Signatures { + sign := req.Signatures[i].GetSign() + require.Equal(t, peer, req.Signatures[i].GetPeer()) + require.NoError(t, crypto.Verify(&key.PublicKey, data, sign)) + } +} + +func TestVerifyRequestHeader(t *testing.T) { + req := &TestRequest{ + IntField: math.MaxInt32, + StringField: "TestRequestStringField", + BytesField: []byte("TestRequestBytesField"), + RequestMetaHeader: RequestMetaHeader{TTL: 10}, + } + + for i := 0; i < 10; i++ { + req.TTL-- + require.NoError(t, SignRequestHeader(test.DecodeKey(i), req)) + } + + require.NoError(t, VerifyRequestHeader(req)) +} + +func TestMaintainableRequest(t *testing.T) { + req := &TestRequest{ + IntField: math.MaxInt32, + StringField: "TestRequestStringField", + BytesField: []byte("TestRequestBytesField"), + RequestMetaHeader: RequestMetaHeader{TTL: 10}, + } + + count := 10 + owner := test.DecodeKey(count + 1) + + for i := 0; i < count; i++ { + req.TTL-- + + key := test.DecodeKey(i) + require.NoError(t, SignRequestHeader(key, req)) + + // sign first key (session key) by owner key + if i == 0 { + sign, err := crypto.Sign(owner, crypto.MarshalPublicKey(&key.PublicKey)) + require.NoError(t, err) + + req.SetOwner(&owner.PublicKey, sign) + } + } + + { // Good case: + require.NoError(t, VerifyRequestHeader(req)) + + // validate, that first key (session key) was signed with owner + signatures := req.GetSignatures() + + require.Len(t, signatures, count) + + pub, err := req.GetOwner() + require.NoError(t, err) + + require.Equal(t, &owner.PublicKey, pub) + } + + { // wrong owner: + req.Signatures[0].Origin = nil + + pub, err := req.GetOwner() + require.NoError(t, err) + + require.NotEqual(t, &owner.PublicKey, pub) + } + + { // Wrong signatures: + copy(req.Signatures[count-1].Sign, req.Signatures[count-1].Peer) + err := VerifyRequestHeader(req) + require.EqualError(t, errors.Cause(err), crypto.ErrInvalidSignature.Error()) + } +} + +func TestVerifyAndSignRequestHeaderWithoutCloning(t *testing.T) { + key := test.DecodeKey(0) + + custom := testCustomField{1, 2, 3, 4, 5, 6, 7, 8} + + b := &TestRequest{ + IntField: math.MaxInt32, + StringField: "TestRequestStringField", + BytesField: []byte("TestRequestBytesField"), + CustomField: &custom, + RequestMetaHeader: RequestMetaHeader{ + TTL: math.MaxInt32 - 8, + Epoch: math.MaxInt64 - 12, + }, + } + + require.NoError(t, SignRequestHeader(key, b)) + require.NoError(t, VerifyRequestHeader(b)) + + require.Len(t, b.Signatures, 1) + require.Equal(t, custom, *b.CustomField) + require.Equal(t, uint32(math.MaxInt32-8), b.GetTTL()) + require.Equal(t, uint64(math.MaxInt64-12), b.GetEpoch()) + + buf := bytes.NewBuffer(nil) + log.SetOutput(buf) + + cp, ok := proto.Clone(b).(*TestRequest) + require.True(t, ok) + require.NotEqual(t, b, cp) + + require.Contains(t, buf.String(), "proto: don't know how to copy") +} diff --git a/service/verify_test.pb.go b/service/verify_test.pb.go new file mode 100644 index 0000000..06e7971 --- /dev/null +++ b/service/verify_test.pb.go @@ -0,0 +1,572 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: service/verify_test.proto + +package service + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// 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 + +type TestRequest struct { + IntField int32 `protobuf:"varint,1,opt,name=IntField,proto3" json:"IntField,omitempty"` + StringField string `protobuf:"bytes,2,opt,name=StringField,proto3" json:"StringField,omitempty"` + BytesField []byte `protobuf:"bytes,3,opt,name=BytesField,proto3" json:"BytesField,omitempty"` + CustomField *testCustomField `protobuf:"bytes,4,opt,name=CustomField,proto3,customtype=testCustomField" json:"CustomField,omitempty"` + RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + RequestVerificationHeader `protobuf:"bytes,99,opt,name=Header,proto3,embedded=Header" json:"Header"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TestRequest) Reset() { *m = TestRequest{} } +func (m *TestRequest) String() string { return proto.CompactTextString(m) } +func (*TestRequest) ProtoMessage() {} +func (*TestRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1effa83201a30d75, []int{0} +} +func (m *TestRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *TestRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TestRequest.Merge(m, src) +} +func (m *TestRequest) XXX_Size() int { + return m.Size() +} +func (m *TestRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TestRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TestRequest proto.InternalMessageInfo + +func (m *TestRequest) GetIntField() int32 { + if m != nil { + return m.IntField + } + return 0 +} + +func (m *TestRequest) GetStringField() string { + if m != nil { + return m.StringField + } + return "" +} + +func (m *TestRequest) GetBytesField() []byte { + if m != nil { + return m.BytesField + } + return nil +} + +func init() { + proto.RegisterType((*TestRequest)(nil), "service.TestRequest") +} + +func init() { proto.RegisterFile("service/verify_test.proto", fileDescriptor_1effa83201a30d75) } + +var fileDescriptor_1effa83201a30d75 = []byte{ + // 322 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0x31, 0x4f, 0xc3, 0x30, + 0x10, 0x85, 0xeb, 0x52, 0x4a, 0x71, 0x90, 0x90, 0x0c, 0x43, 0xc9, 0x90, 0x46, 0x9d, 0xb2, 0x34, + 0x91, 0x40, 0x48, 0x4c, 0x0c, 0x01, 0x21, 0x18, 0x58, 0x02, 0x62, 0x60, 0x41, 0x49, 0x7a, 0x0d, + 0x96, 0x68, 0x5c, 0xe2, 0x4b, 0xa5, 0xfe, 0x13, 0x66, 0x7e, 0x4d, 0xc7, 0x8e, 0x88, 0xa1, 0x42, + 0xe1, 0x8f, 0xa0, 0xd8, 0x06, 0x05, 0xd8, 0xfc, 0xde, 0xfb, 0x9e, 0xed, 0x3b, 0x7a, 0x20, 0xa1, + 0x98, 0xf3, 0x14, 0x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0x0e, 0xd3, 0x0d, 0x4f, 0x97, 0x95, 0x43, + 0x56, 0x95, 0x43, 0xde, 0x2a, 0x87, 0x7c, 0x54, 0x0e, 0x79, 0xf9, 0x74, 0x5a, 0xf7, 0x5e, 0x63, + 0xd3, 0xb9, 0x9c, 0xa5, 0xe9, 0x68, 0x0c, 0xf3, 0x20, 0x07, 0x31, 0x91, 0x23, 0xbd, 0x67, 0xf3, + 0x56, 0xd2, 0x55, 0xf2, 0xe8, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x37, 0x92, 0xd2, 0xea, 0x01, + 0x00, 0x00, +} + +func (m *TestRequest) 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 *TestRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TestRequest) 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) + } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerifyTest(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVerifyTest(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 + if m.CustomField != nil { + { + size := m.CustomField.Size() + i -= size + if _, err := m.CustomField.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintVerifyTest(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.BytesField) > 0 { + i -= len(m.BytesField) + copy(dAtA[i:], m.BytesField) + i = encodeVarintVerifyTest(dAtA, i, uint64(len(m.BytesField))) + i-- + dAtA[i] = 0x1a + } + if len(m.StringField) > 0 { + i -= len(m.StringField) + copy(dAtA[i:], m.StringField) + i = encodeVarintVerifyTest(dAtA, i, uint64(len(m.StringField))) + i-- + dAtA[i] = 0x12 + } + if m.IntField != 0 { + i = encodeVarintVerifyTest(dAtA, i, uint64(m.IntField)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintVerifyTest(dAtA []byte, offset int, v uint64) int { + offset -= sovVerifyTest(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *TestRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IntField != 0 { + n += 1 + sovVerifyTest(uint64(m.IntField)) + } + l = len(m.StringField) + if l > 0 { + n += 1 + l + sovVerifyTest(uint64(l)) + } + l = len(m.BytesField) + if l > 0 { + n += 1 + l + sovVerifyTest(uint64(l)) + } + if m.CustomField != nil { + l = m.CustomField.Size() + n += 1 + l + sovVerifyTest(uint64(l)) + } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovVerifyTest(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovVerifyTest(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovVerifyTest(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozVerifyTest(x uint64) (n int) { + return sovVerifyTest(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *TestRequest) 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 ErrIntOverflowVerifyTest + } + 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: TestRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TestRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IntField", wireType) + } + m.IntField = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.IntField |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StringField", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthVerifyTest + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthVerifyTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StringField = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BytesField", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerifyTest + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerifyTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BytesField = append(m.BytesField[:0], dAtA[iNdEx:postIndex]...) + if m.BytesField == nil { + m.BytesField = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CustomField", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVerifyTest + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVerifyTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v testCustomField + m.CustomField = &v + if err := m.CustomField.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerifyTest + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerifyTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVerifyTest + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVerifyTest + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVerifyTest + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVerifyTest(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthVerifyTest + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthVerifyTest + } + 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 skipVerifyTest(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, ErrIntOverflowVerifyTest + } + 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, ErrIntOverflowVerifyTest + } + 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, ErrIntOverflowVerifyTest + } + 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, ErrInvalidLengthVerifyTest + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupVerifyTest + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthVerifyTest + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthVerifyTest = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowVerifyTest = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupVerifyTest = fmt.Errorf("proto: unexpected end of group") +) diff --git a/service/verify_test.proto b/service/verify_test.proto new file mode 100644 index 0000000..c632615 --- /dev/null +++ b/service/verify_test.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +package service; +option go_package = "github.com/nspcc-dev/neofs-proto/service"; + +import "service/meta.proto"; +import "service/verify.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.stable_marshaler_all) = true; + +message TestRequest { + int32 IntField = 1; + string StringField = 2; + bytes BytesField = 3; + bytes CustomField = 4 [(gogoproto.customtype) = "testCustomField"]; + RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + RequestVerificationHeader Header = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} diff --git a/session/service.pb.go b/session/service.pb.go index b99b611..8532523 100644 --- a/session/service.pb.go +++ b/session/service.pb.go @@ -8,6 +8,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" + service "github.com/nspcc-dev/neofs-proto/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -33,10 +34,14 @@ type CreateRequest struct { // Types that are valid to be assigned to Message: // *CreateRequest_Init // *CreateRequest_Signed - Message isCreateRequest_Message `protobuf_oneof:"Message"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Message isCreateRequest_Message `protobuf_oneof:"Message"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateRequest) Reset() { *m = CreateRequest{} } @@ -205,25 +210,30 @@ func init() { func init() { proto.RegisterFile("session/service.proto", fileDescriptor_b329bee0fd1148e0) } var fileDescriptor_b329bee0fd1148e0 = []byte{ - // 284 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xbd, 0x4e, 0xc3, 0x30, - 0x10, 0xc7, 0x6b, 0x84, 0x12, 0x30, 0xa2, 0x83, 0x11, 0x50, 0x65, 0xb0, 0x50, 0xc5, 0x90, 0x81, - 0x24, 0xa8, 0xcc, 0x30, 0x94, 0xa5, 0x0c, 0x2c, 0x29, 0x2c, 0x6c, 0x4d, 0x7a, 0x35, 0xe6, 0xc3, - 0x0e, 0x39, 0xa7, 0x12, 0x6f, 0xc2, 0x23, 0x31, 0x32, 0x32, 0xa2, 0xf0, 0x22, 0x08, 0x3b, 0xad, - 0x82, 0x50, 0x36, 0xff, 0x3f, 0x7c, 0x3f, 0xfb, 0xe8, 0x3e, 0x02, 0xa2, 0xd4, 0x2a, 0x41, 0x28, - 0x97, 0x32, 0x87, 0xb8, 0x28, 0xb5, 0xd1, 0xcc, 0x6f, 0xec, 0x60, 0x6f, 0x95, 0x9b, 0xd7, 0x02, - 0xd0, 0xa5, 0x41, 0x24, 0xa4, 0xb9, 0xaf, 0xb2, 0x38, 0xd7, 0xcf, 0x89, 0xd0, 0x42, 0x27, 0xd6, - 0xce, 0xaa, 0x85, 0x55, 0x56, 0xd8, 0x93, 0xab, 0x0f, 0x1f, 0xe8, 0xee, 0x65, 0x09, 0x33, 0x03, - 0x29, 0xbc, 0x54, 0x80, 0x86, 0x1d, 0xd3, 0xcd, 0x2b, 0x25, 0xcd, 0x80, 0x1c, 0x91, 0x70, 0x67, - 0xd4, 0x8f, 0x1b, 0x46, 0x7c, 0xa3, 0x1f, 0x41, 0x4d, 0x7a, 0xa9, 0x4d, 0x59, 0x48, 0xbd, 0xa9, - 0x14, 0x0a, 0xe6, 0x83, 0x8d, 0x8e, 0x5e, 0x93, 0x8f, 0xb7, 0xa9, 0x7f, 0x0d, 0x88, 0x33, 0x01, - 0x43, 0xa4, 0xfd, 0x15, 0x0b, 0x0b, 0xad, 0x10, 0xd8, 0x09, 0xdd, 0xba, 0x55, 0xe8, 0x06, 0x75, - 0x01, 0xd7, 0x8d, 0x5f, 0x68, 0x0a, 0x58, 0x3d, 0x99, 0x6e, 0xa8, 0xcb, 0x5b, 0xd0, 0xd1, 0x84, - 0xfa, 0x53, 0xd7, 0x62, 0xe7, 0xd4, 0x73, 0x7c, 0x76, 0xb0, 0xbe, 0xf9, 0xe7, 0xf3, 0xc1, 0xe1, - 0x3f, 0xdf, 0x3d, 0x34, 0x24, 0xa7, 0x64, 0x7c, 0xf1, 0x5e, 0x73, 0xf2, 0x51, 0x73, 0xf2, 0x59, - 0x73, 0xf2, 0x55, 0x73, 0xf2, 0xf6, 0xcd, 0x7b, 0x77, 0x61, 0x6b, 0xdf, 0x0a, 0x8b, 0x3c, 0x8f, - 0xe6, 0xb0, 0x4c, 0x14, 0xe8, 0x05, 0x46, 0x6e, 0xdb, 0xcd, 0xc8, 0xcc, 0xb3, 0xf2, 0xec, 0x27, - 0x00, 0x00, 0xff, 0xff, 0x74, 0x3d, 0x2a, 0x06, 0xd7, 0x01, 0x00, 0x00, + // 364 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x51, 0xbd, 0x4e, 0xeb, 0x30, + 0x14, 0xae, 0xaf, 0xaa, 0xb4, 0xd7, 0x57, 0xb7, 0x83, 0xef, 0x0f, 0x51, 0x86, 0x14, 0x55, 0x0c, + 0x19, 0x68, 0x82, 0xca, 0xc2, 0x02, 0x43, 0x61, 0x28, 0x43, 0x97, 0x14, 0x18, 0xd8, 0x92, 0xf4, + 0x34, 0x58, 0x50, 0x3b, 0xc4, 0x4e, 0xa5, 0xbe, 0x09, 0x8f, 0xd4, 0xb1, 0x23, 0x53, 0x85, 0xc2, + 0xc6, 0x53, 0xa0, 0xda, 0x4e, 0x55, 0xa8, 0xba, 0xf9, 0x7c, 0x3f, 0xe7, 0x9c, 0xcf, 0x07, 0xff, + 0x13, 0x20, 0x04, 0xe5, 0x2c, 0x10, 0x90, 0xcf, 0x68, 0x02, 0x7e, 0x96, 0x73, 0xc9, 0x49, 0xc3, + 0xc0, 0xce, 0x9f, 0x8a, 0x97, 0xf3, 0x0c, 0x84, 0x66, 0x1d, 0x62, 0xc4, 0xc1, 0x14, 0x64, 0x64, + 0xb0, 0xbf, 0x15, 0x36, 0x83, 0x9c, 0x4e, 0xe6, 0x06, 0xed, 0xa6, 0x54, 0x3e, 0x14, 0xb1, 0x9f, + 0xf0, 0x69, 0x90, 0xf2, 0x94, 0x07, 0x0a, 0x8e, 0x8b, 0x89, 0xaa, 0x54, 0xa1, 0x5e, 0x5a, 0xde, + 0xf9, 0x40, 0xf8, 0xf7, 0x65, 0x0e, 0x91, 0x84, 0x10, 0x9e, 0x0b, 0x10, 0x92, 0x1c, 0xe1, 0xfa, + 0x35, 0xa3, 0xd2, 0x46, 0x87, 0xc8, 0xfb, 0xd5, 0x6b, 0xf9, 0x66, 0x1d, 0xff, 0x86, 0x3f, 0x02, + 0x1b, 0xd4, 0x42, 0xc5, 0x12, 0x0f, 0x5b, 0x23, 0x9a, 0x32, 0x18, 0xdb, 0x3f, 0xf6, 0xe8, 0x0c, + 0x4f, 0xce, 0x70, 0x7d, 0x08, 0x32, 0xb2, 0x63, 0xa5, 0x73, 0xfc, 0x2a, 0xb6, 0x99, 0xb7, 0xe6, + 0x06, 0x10, 0x8d, 0x21, 0xef, 0x37, 0x17, 0xab, 0x76, 0x6d, 0xb9, 0x6a, 0xa3, 0x50, 0x39, 0xc8, + 0x15, 0xb6, 0xee, 0x54, 0x34, 0x3b, 0x51, 0xde, 0xce, 0x77, 0xaf, 0x62, 0x69, 0x12, 0x49, 0xca, + 0xd9, 0x4e, 0x0f, 0xe3, 0xed, 0xff, 0xc4, 0x8d, 0x21, 0x08, 0x11, 0xa5, 0xd0, 0x11, 0xb8, 0x55, + 0x65, 0x15, 0x19, 0x67, 0x02, 0xc8, 0x31, 0x6e, 0xde, 0x32, 0xa1, 0x83, 0xec, 0x0b, 0xbc, 0x51, + 0xac, 0x43, 0x87, 0x20, 0x8a, 0x27, 0xb9, 0x3f, 0xb4, 0xe6, 0xb7, 0x86, 0xf6, 0x06, 0xb8, 0x31, + 0xd2, 0x2a, 0x72, 0x8e, 0x2d, 0x3d, 0x9f, 0xfc, 0xdf, 0x38, 0xbf, 0x7c, 0xbe, 0x73, 0xb0, 0x83, + 0xeb, 0x45, 0x3d, 0x74, 0x82, 0xfa, 0x17, 0x8b, 0xd2, 0x45, 0xcb, 0xd2, 0x45, 0xaf, 0xa5, 0x8b, + 0xde, 0x4a, 0x17, 0xbd, 0xbc, 0xbb, 0xb5, 0x7b, 0x6f, 0xeb, 0xe0, 0x4c, 0x64, 0x49, 0xd2, 0x1d, + 0xc3, 0x2c, 0x60, 0xc0, 0x27, 0xa2, 0xab, 0xcf, 0x6d, 0x5a, 0xc6, 0x96, 0x2a, 0x4f, 0x3f, 0x03, + 0x00, 0x00, 0xff, 0xff, 0xf6, 0xdd, 0x2a, 0xdb, 0x82, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -382,6 +392,30 @@ func (m *CreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 if m.Message != nil { { size := m.Message.Size() @@ -534,6 +568,10 @@ func (m *CreateRequest) Size() (n int) { if m.Message != nil { n += m.Message.Size() } + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -709,6 +747,72 @@ func (m *CreateRequest) Unmarshal(dAtA []byte) error { } m.Message = &CreateRequest_Signed{v} iNdEx = postIndex + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/session/service.proto b/session/service.proto index 4b37aaf..377e77e 100644 --- a/session/service.proto +++ b/session/service.proto @@ -3,6 +3,8 @@ package session; option go_package = "github.com/nspcc-dev/neofs-proto/session"; import "session/types.proto"; +import "service/meta.proto"; +import "service/verify.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.stable_marshaler_all) = true; @@ -34,6 +36,10 @@ message CreateRequest { // Signed Init message response (Unsigned) from server with user private key session.Token Signed = 2; } + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; } message CreateResponse { diff --git a/state/service.pb.go b/state/service.pb.go index a368410..520c8ce 100644 --- a/state/service.pb.go +++ b/state/service.pb.go @@ -9,6 +9,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" bootstrap "github.com/nspcc-dev/neofs-proto/bootstrap" + service "github.com/nspcc-dev/neofs-proto/service" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -30,9 +31,13 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // NetmapRequest message to request current node netmap type NetmapRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *NetmapRequest) Reset() { *m = NetmapRequest{} } @@ -66,9 +71,13 @@ var xxx_messageInfo_NetmapRequest proto.InternalMessageInfo // MetricsRequest message to request node metrics type MetricsRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *MetricsRequest) Reset() { *m = MetricsRequest{} } @@ -148,9 +157,13 @@ func (m *MetricsResponse) GetMetrics() [][]byte { // HealthRequest message to check current state type HealthRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *HealthRequest) Reset() { *m = HealthRequest{} } @@ -247,27 +260,33 @@ func init() { func init() { proto.RegisterFile("state/service.proto", fileDescriptor_695592f6f2fc97b7) } var fileDescriptor_695592f6f2fc97b7 = []byte{ - // 320 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xbf, 0x4e, 0xc3, 0x30, - 0x10, 0xc6, 0x31, 0x88, 0x02, 0x06, 0x5a, 0x64, 0xda, 0x2a, 0xca, 0x10, 0x55, 0x1d, 0x50, 0x25, - 0xd4, 0x44, 0x02, 0x06, 0x84, 0x98, 0xca, 0xc2, 0x52, 0x86, 0x74, 0x63, 0x73, 0xdc, 0xeb, 0x1f, - 0x41, 0x6b, 0x13, 0x5f, 0x2a, 0xf5, 0x4d, 0x78, 0x10, 0x1e, 0x82, 0x91, 0x91, 0x11, 0x85, 0x17, - 0x41, 0xd8, 0x71, 0x20, 0xdd, 0xf2, 0xfd, 0x2e, 0xdf, 0xf9, 0xbb, 0x3b, 0x7a, 0xaa, 0x91, 0x23, - 0x44, 0x1a, 0xd2, 0xd5, 0x5c, 0x40, 0xa8, 0x52, 0x89, 0x92, 0xed, 0x1a, 0xe8, 0xb7, 0x12, 0x29, - 0x51, 0x63, 0xca, 0x55, 0x84, 0x6b, 0x05, 0xda, 0x56, 0xfd, 0xfe, 0x74, 0x8e, 0xb3, 0x2c, 0x09, - 0x85, 0x5c, 0x44, 0x53, 0x39, 0x95, 0x91, 0xc1, 0x49, 0x36, 0x31, 0xca, 0x08, 0xf3, 0x65, 0x7f, - 0xef, 0x36, 0xe8, 0xf1, 0x03, 0xe0, 0x82, 0xab, 0x18, 0x5e, 0x32, 0xd0, 0xd8, 0x3d, 0xa1, 0xf5, - 0x21, 0x60, 0x3a, 0x17, 0xda, 0x91, 0x73, 0xda, 0x28, 0x89, 0x56, 0x72, 0xa9, 0x81, 0x79, 0x74, - 0xaf, 0x40, 0x1e, 0xe9, 0xec, 0xf4, 0x8e, 0x62, 0x27, 0x7f, 0xfb, 0xdd, 0x03, 0x7f, 0xc6, 0x99, - 0x73, 0x0f, 0x68, 0xdd, 0x81, 0x3f, 0xb3, 0x25, 0x6b, 0x8f, 0x74, 0x48, 0x6f, 0x3f, 0x76, 0x92, - 0xb5, 0x69, 0x6d, 0x84, 0x1c, 0x33, 0xed, 0x6d, 0x77, 0x48, 0xef, 0x20, 0x2e, 0xd4, 0xc5, 0x1b, - 0x71, 0x05, 0x76, 0x45, 0x6b, 0x36, 0x2f, 0x6b, 0x86, 0x66, 0x0f, 0x61, 0x25, 0xbe, 0xdf, 0x0c, - 0xcb, 0xb5, 0x84, 0x23, 0x95, 0x02, 0x1f, 0x0f, 0xb9, 0x62, 0xd7, 0x65, 0x5e, 0xd6, 0x2a, 0x6c, - 0xd5, 0x21, 0xfd, 0xf6, 0x26, 0x2e, 0xc2, 0xde, 0xd0, 0x43, 0x9b, 0xee, 0x6e, 0x06, 0xe2, 0xa9, - 0x7c, 0xb4, 0x32, 0xa3, 0xdf, 0xda, 0xa0, 0xd6, 0x3b, 0xb8, 0x7d, 0xcf, 0x03, 0xf2, 0x91, 0x07, - 0xe4, 0x33, 0x0f, 0xc8, 0x57, 0x1e, 0x90, 0xd7, 0xef, 0x60, 0xeb, 0xf1, 0xec, 0xdf, 0x81, 0x96, - 0x5a, 0x09, 0xd1, 0x1f, 0xc3, 0x2a, 0x5a, 0x82, 0x9c, 0xe8, 0xbe, 0x3d, 0x8f, 0x69, 0x96, 0xd4, - 0x8c, 0xb8, 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0x73, 0xd9, 0x9d, 0xd0, 0x04, 0x02, 0x00, 0x00, + // 408 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 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 0xb9, 0x23, 0xb9, 0x56, 0x42, 0x0c, 0x17, 0xb0, 0x8d, 0x73, 0x90, + 0x4b, 0x3d, 0xac, 0x6f, 0x88, 0x39, 0x2c, 0x75, 0x8c, 0x78, 0xf1, 0x3b, 0x00, 0x00, 0xff, 0xff, + 0x78, 0x9b, 0x96, 0xe5, 0xb1, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -454,6 +473,30 @@ func (m *NetmapRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 return len(dAtA) - i, nil } @@ -481,6 +524,30 @@ func (m *MetricsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 return len(dAtA) - i, nil } @@ -544,6 +611,30 @@ func (m *HealthRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + { + size, err := m.RequestVerificationHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x9a + { + size, err := m.RequestMetaHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6 + i-- + dAtA[i] = 0x92 return len(dAtA) - i, nil } @@ -608,6 +699,10 @@ func (m *NetmapRequest) Size() (n int) { } var l int _ = l + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -620,6 +715,10 @@ func (m *MetricsRequest) Size() (n int) { } var l int _ = l + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -650,6 +749,10 @@ func (m *HealthRequest) Size() (n int) { } var l int _ = l + l = m.RequestMetaHeader.Size() + n += 2 + l + sovService(uint64(l)) + l = m.RequestVerificationHeader.Size() + n += 2 + l + sovService(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -710,6 +813,72 @@ func (m *NetmapRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: NetmapRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -764,6 +933,72 @@ func (m *MetricsRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: MetricsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -904,6 +1139,72 @@ func (m *HealthRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: HealthRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 98: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestMetaHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 99: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestVerificationHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RequestVerificationHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/state/service.proto b/state/service.proto index 3c85d86..ed90e26 100644 --- a/state/service.proto +++ b/state/service.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package state; option go_package = "github.com/nspcc-dev/neofs-proto/state"; +import "service/meta.proto"; +import "service/verify.proto"; import "bootstrap/types.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; @@ -19,10 +21,20 @@ service Status { } // NetmapRequest message to request current node netmap -message NetmapRequest {} +message NetmapRequest { + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} // MetricsRequest message to request node metrics -message MetricsRequest {} +message MetricsRequest { + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} // MetricsResponse contains [][]byte, // every []byte is marshaled MetricFamily proto message @@ -32,7 +44,12 @@ message MetricsResponse { } // HealthRequest message to check current state -message HealthRequest {} +message HealthRequest { + // RequestMetaHeader contains information about request meta headers (should be embedded into message) + service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) + service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; +} // HealthResponse message with current state message HealthResponse {