service: get rid of signature field in container + proto generate

remotes/KirillovDenis/feature/refactor-sig-rpc
Evgeniy Kulikov 2019-11-26 15:54:27 +03:00
parent 5fa7d72bba
commit 14f85ced84
No known key found for this signature in database
GPG Key ID: BF6AEE0A2A699BF2
3 changed files with 37 additions and 158 deletions

View File

@ -25,12 +25,6 @@ const (
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 }
// SetSignature sets signature to DeleteRequest to satisfy SignedRequest interface.
func (m *DeleteRequest) SetSignature(v []byte) { m.Signature = v }
// PrepareData prepares bytes representation of PutRequest to satisfy SignedRequest interface.
func (m *PutRequest) PrepareData() ([]byte, error) {
var (

View File

@ -38,8 +38,6 @@ type PutRequest struct {
OwnerID OwnerID `protobuf:"bytes,3,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"`
// Rules define storage policy for the object inside the container.
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"`
// 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)
@ -92,13 +90,6 @@ func (m *PutRequest) GetRules() netmap.PlacementRule {
return netmap.PlacementRule{}
}
func (m *PutRequest) GetSignature() []byte {
if m != nil {
return m.Signature
}
return nil
}
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"`
@ -139,8 +130,6 @@ 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"`
// Signature of the container owner
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)
@ -179,13 +168,6 @@ func (m *DeleteRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo
func (m *DeleteRequest) GetSignature() []byte {
if m != nil {
return m.Signature
}
return nil
}
// DeleteResponse is empty because delete operation is asynchronous and done
// via consensus in inner ring nodes
type DeleteResponse struct {
@ -400,44 +382,43 @@ func init() {
func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) }
var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{
// 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, 0x80, 0x51, 0x43, 0x8d, 0x05, 0x49, 0xe4, 0x55,
0x40, 0xc4, 0x16, 0xa1, 0x12, 0x6c, 0x90, 0x20, 0x89, 0x54, 0x2a, 0x51, 0x11, 0xb9, 0x12, 0x0b,
0x76, 0x8e, 0x7b, 0x13, 0x2c, 0x25, 0xb6, 0xf1, 0x8c, 0x83, 0xf2, 0x26, 0xbc, 0x03, 0x2f, 0xc0,
0x23, 0x74, 0xc1, 0xa2, 0x1b, 0x24, 0xc4, 0x22, 0x42, 0x61, 0xcd, 0x3b, 0x20, 0x8f, 0xc7, 0x3f,
0x49, 0xcb, 0xcf, 0xae, 0x6c, 0x2c, 0xcf, 0x39, 0xf7, 0x9e, 0x99, 0x73, 0xef, 0xdc, 0x81, 0x7d,
0xc7, 0xf7, 0xb8, 0xed, 0x7a, 0x18, 0x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, 0x75, 0x7e, 0x10, 0xd8, 0x3e, 0x49, 0xb6, 0xa1, 0x07, 0x50, 0x1a,
0x44, 0x9c, 0xd6, 0x0a, 0xd5, 0xc9, 0x1f, 0x17, 0xed, 0xe6, 0x3a, 0x2c, 0x37, 0x78, 0x02, 0x95,
0xe4, 0xba, 0x50, 0xb5, 0x10, 0xb1, 0x32, 0x0f, 0xda, 0xad, 0x4b, 0x18, 0x99, 0x7e, 0x00, 0xa5,
0x43, 0x5c, 0xdd, 0x34, 0xbf, 0x6a, 0x2b, 0x9b, 0x16, 0x9b, 0xfa, 0x08, 0xca, 0xb1, 0x4b, 0x5a,
0xe4, 0x0b, 0x0d, 0xd3, 0xf6, 0x2f, 0xe0, 0x49, 0x62, 0xf7, 0xe9, 0xd9, 0xb2, 0x4e, 0xce, 0x97,
0x75, 0xf2, 0x65, 0x59, 0x27, 0xdf, 0x96, 0x75, 0xf2, 0xfe, 0x7b, 0x7d, 0xe3, 0xf5, 0xaf, 0x9e,
0x68, 0x7f, 0xc4, 0xda, 0xc9, 0xa3, 0x9b, 0xc9, 0x0d, 0x2b, 0x02, 0x78, 0xf8, 0x33, 0x00, 0x00,
0xff, 0xff, 0xd2, 0x95, 0x12, 0x0c, 0x3c, 0x06, 0x00, 0x00,
// 562 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcd, 0x6e, 0xd3, 0x4c,
0x14, 0xed, 0x34, 0xf9, 0xd2, 0xe6, 0xba, 0x1f, 0x3f, 0xa3, 0x86, 0x1a, 0x4b, 0x24, 0x91, 0x57,
0x01, 0x11, 0x5b, 0x84, 0x4a, 0xb0, 0x41, 0x82, 0x24, 0x52, 0xa9, 0x44, 0x45, 0x64, 0x24, 0x16,
0xec, 0x1c, 0xf7, 0x26, 0x58, 0x72, 0x6c, 0xe3, 0x19, 0x07, 0xe5, 0x4d, 0x78, 0x07, 0x24, 0xb6,
0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 0xdf, 0x85, 0xbd, 0xb4, 0xf2, 0xcd, 0xe9, 0xac, 0x5c, 0x76, 0x59, 0xbd, 0x9f, 0x04,
0x76, 0x5e, 0xa5, 0xc7, 0xd0, 0x43, 0xa8, 0x8c, 0x62, 0x4e, 0x1b, 0xa5, 0xee, 0x14, 0x0f, 0x84,
0x76, 0x6b, 0x13, 0x96, 0x07, 0x3c, 0x81, 0x5a, 0x3a, 0x2e, 0x54, 0x2d, 0x45, 0xac, 0x4d, 0xbc,
0x76, 0xfb, 0x12, 0x46, 0xca, 0x0f, 0xa1, 0x72, 0x84, 0xeb, 0x87, 0x16, 0xa3, 0xb6, 0x76, 0x68,
0xf9, 0x52, 0x1f, 0x41, 0x35, 0x71, 0x49, 0xcb, 0x7c, 0xe9, 0xc2, 0xb4, 0x83, 0x0b, 0x78, 0x2a,
0xec, 0x3f, 0x3d, 0x5b, 0x35, 0xc9, 0xf9, 0xaa, 0x49, 0xbe, 0xae, 0x9a, 0xe4, 0xfb, 0xaa, 0x49,
0x3e, 0xfc, 0x68, 0x6e, 0xbd, 0xf9, 0xdd, 0x33, 0x1b, 0x4c, 0x58, 0x37, 0x7d, 0x38, 0xf3, 0x74,
0xe3, 0x9a, 0x00, 0x1e, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x36, 0x72, 0xbd, 0x89, 0x00, 0x06,
0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -690,13 +671,6 @@ func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
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] = 0x2a
}
{
size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
@ -820,13 +794,6 @@ func (m *DeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
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] = 0x12
}
{
size := m.CID.Size()
i -= size
@ -1095,10 +1062,6 @@ func (m *PutRequest) Size() (n int) {
n += 1 + l + sovService(uint64(l))
l = m.Rules.Size()
n += 1 + l + sovService(uint64(l))
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()
@ -1131,10 +1094,6 @@ func (m *DeleteRequest) Size() (n int) {
_ = l
l = m.CID.Size()
n += 1 + l + sovService(uint64(l))
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()
@ -1380,40 +1339,6 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...)
if m.Signature == nil {
m.Signature = []byte{}
}
iNdEx = postIndex
case 98:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)
@ -1654,40 +1579,6 @@ func (m *DeleteRequest) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...)
if m.Signature == nil {
m.Signature = []byte{}
}
iNdEx = postIndex
case 98:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)

View File

@ -41,9 +41,6 @@ message PutRequest {
// Rules define storage policy for the object inside the container.
netmap.PlacementRule rules = 4 [(gogoproto.nullable) = false];
// Signature of the user (owner id)
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)
@ -59,9 +56,6 @@ message DeleteRequest {
// CID (container id) is a SHA256 hash of the container structure
bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false];
// Signature of the container owner
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)