add peerId to space receipt

This commit is contained in:
Sergey Cherepanov 2023-02-23 14:13:11 +03:00 committed by Mikhail Iudin
parent 33e1065e4d
commit 6eb84043f0
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0
2 changed files with 93 additions and 36 deletions

View File

@ -165,13 +165,16 @@ func (m *SpaceReceiptWithSignature) GetSignature() []byte {
// SpaceReceipt contains permission to SpacePush operation // SpaceReceipt contains permission to SpacePush operation
type SpaceReceipt struct { type SpaceReceipt struct {
// spaceId
SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"`
// peerId of receipt requester
PeerId string `protobuf:"bytes,2,opt,name=peerId,proto3" json:"peerId,omitempty"`
// identity of space owner // identity of space owner
AccountIdentity []byte `protobuf:"bytes,2,opt,name=accountIdentity,proto3" json:"accountIdentity,omitempty"` AccountIdentity []byte `protobuf:"bytes,3,opt,name=accountIdentity,proto3" json:"accountIdentity,omitempty"`
// identity of control node // identity of control node
ControlNodeIdentity []byte `protobuf:"bytes,3,opt,name=controlNodeIdentity,proto3" json:"controlNodeIdentity,omitempty"` ControlNodeIdentity []byte `protobuf:"bytes,4,opt,name=controlNodeIdentity,proto3" json:"controlNodeIdentity,omitempty"`
// unix-timestamp with a deadline time of receipt validity // unix-timestamp with a deadline time of receipt validity
ValidUntil uint64 `protobuf:"varint,4,opt,name=validUntil,proto3" json:"validUntil,omitempty"` ValidUntil uint64 `protobuf:"varint,5,opt,name=validUntil,proto3" json:"validUntil,omitempty"`
} }
func (m *SpaceReceipt) Reset() { *m = SpaceReceipt{} } func (m *SpaceReceipt) Reset() { *m = SpaceReceipt{} }
@ -214,6 +217,13 @@ func (m *SpaceReceipt) GetSpaceId() string {
return "" return ""
} }
func (m *SpaceReceipt) GetPeerId() string {
if m != nil {
return m.PeerId
}
return ""
}
func (m *SpaceReceipt) GetAccountIdentity() []byte { func (m *SpaceReceipt) GetAccountIdentity() []byte {
if m != nil { if m != nil {
return m.AccountIdentity return m.AccountIdentity
@ -348,32 +358,33 @@ func init() {
} }
var fileDescriptor_d94f6f99586adae2 = []byte{ var fileDescriptor_d94f6f99586adae2 = []byte{
// 390 bytes of a gzipped FileDescriptorProto // 409 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0xdd, 0x4e, 0xc2, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0xdd, 0x6a, 0xe2, 0x40,
0x18, 0xa5, 0x88, 0x12, 0x3e, 0x88, 0x3f, 0xf5, 0x27, 0x93, 0x60, 0x43, 0x66, 0x62, 0xb8, 0x30, 0x14, 0x76, 0x5c, 0x7f, 0xc8, 0x51, 0xf6, 0x67, 0x76, 0x57, 0xb2, 0xe2, 0x0e, 0x92, 0x85, 0xc5,
0x60, 0x30, 0x7a, 0x6d, 0x24, 0x31, 0xc1, 0x18, 0x63, 0x46, 0x88, 0x51, 0xaf, 0xe6, 0xd6, 0x48, 0x8b, 0x45, 0x17, 0x97, 0xdd, 0xeb, 0xa5, 0x42, 0xc1, 0x52, 0x4a, 0x19, 0x91, 0xd2, 0xf6, 0x2a,
0xc3, 0x5c, 0xe7, 0x56, 0x4c, 0x78, 0x0b, 0x1f, 0xc2, 0x47, 0xf0, 0x21, 0xbc, 0xe4, 0xd2, 0x4b, 0x4d, 0x86, 0x3a, 0x98, 0x66, 0xd2, 0x64, 0x2c, 0xf8, 0x16, 0x7d, 0x98, 0x5e, 0xf6, 0x01, 0x7a,
0x03, 0x2f, 0x62, 0xd6, 0x31, 0x28, 0x38, 0xb8, 0xd9, 0xd6, 0xf3, 0x9d, 0xf3, 0x7d, 0xa7, 0x3b, 0xe9, 0x65, 0x2f, 0x8b, 0xbe, 0x48, 0xc9, 0xc4, 0xe8, 0x68, 0xa3, 0x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 0x87, 0x04, 0x7d, 0x8c, 0x48, 0x6a, 0x30, 0x22, 0xa9, 0x9f, 0x11, 0x49, 0x3d, 0x17, 0x6c, 0x6d, 0x28, 0x32, 0xff, 0x42, 0xfd, 0xc7, 0x5e, 0x4e, 0x52, 0xfa, 0xe0, 0xdf, 0xd3,
0x96, 0x96, 0x5d, 0x9d, 0xe7, 0x35, 0xf9, 0x3a, 0xfd, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x99, 0x06, 0x9c, 0xa0, 0xd9, 0x9c, 0xa0, 0x97, 0x39, 0x41, 0xf7, 0x0b, 0x92, 0x9b, 0x2d, 0x48, 0xee, 0x79,
0x09, 0x83, 0x61, 0x03, 0x00, 0x00, 0x41, 0x72, 0x17, 0x8d, 0x7d, 0x57, 0xea, 0xaa, 0xa4, 0x5e, 0x7f, 0x5e, 0x03, 0x00, 0x00, 0xff,
0xff, 0x77, 0x20, 0x0a, 0xe9, 0x79, 0x03, 0x00, 0x00,
} }
func (m *SpaceSignRequest) Marshal() (dAtA []byte, err error) { func (m *SpaceSignRequest) Marshal() (dAtA []byte, err error) {
@ -501,20 +512,27 @@ func (m *SpaceReceipt) MarshalToSizedBuffer(dAtA []byte) (int, error) {
if m.ValidUntil != 0 { if m.ValidUntil != 0 {
i = encodeVarintCoordinator(dAtA, i, uint64(m.ValidUntil)) i = encodeVarintCoordinator(dAtA, i, uint64(m.ValidUntil))
i-- i--
dAtA[i] = 0x20 dAtA[i] = 0x28
} }
if len(m.ControlNodeIdentity) > 0 { if len(m.ControlNodeIdentity) > 0 {
i -= len(m.ControlNodeIdentity) i -= len(m.ControlNodeIdentity)
copy(dAtA[i:], m.ControlNodeIdentity) copy(dAtA[i:], m.ControlNodeIdentity)
i = encodeVarintCoordinator(dAtA, i, uint64(len(m.ControlNodeIdentity))) i = encodeVarintCoordinator(dAtA, i, uint64(len(m.ControlNodeIdentity)))
i-- i--
dAtA[i] = 0x1a dAtA[i] = 0x22
} }
if len(m.AccountIdentity) > 0 { if len(m.AccountIdentity) > 0 {
i -= len(m.AccountIdentity) i -= len(m.AccountIdentity)
copy(dAtA[i:], m.AccountIdentity) copy(dAtA[i:], m.AccountIdentity)
i = encodeVarintCoordinator(dAtA, i, uint64(len(m.AccountIdentity))) i = encodeVarintCoordinator(dAtA, i, uint64(len(m.AccountIdentity)))
i-- i--
dAtA[i] = 0x1a
}
if len(m.PeerId) > 0 {
i -= len(m.PeerId)
copy(dAtA[i:], m.PeerId)
i = encodeVarintCoordinator(dAtA, i, uint64(len(m.PeerId)))
i--
dAtA[i] = 0x12 dAtA[i] = 0x12
} }
if len(m.SpaceId) > 0 { if len(m.SpaceId) > 0 {
@ -656,6 +674,10 @@ func (m *SpaceReceipt) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovCoordinator(uint64(l)) n += 1 + l + sovCoordinator(uint64(l))
} }
l = len(m.PeerId)
if l > 0 {
n += 1 + l + sovCoordinator(uint64(l))
}
l = len(m.AccountIdentity) l = len(m.AccountIdentity)
if l > 0 { if l > 0 {
n += 1 + l + sovCoordinator(uint64(l)) n += 1 + l + sovCoordinator(uint64(l))
@ -1053,6 +1075,38 @@ func (m *SpaceReceipt) Unmarshal(dAtA []byte) error {
m.SpaceId = string(dAtA[iNdEx:postIndex]) m.SpaceId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PeerId", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowCoordinator
}
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 ErrInvalidLengthCoordinator
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthCoordinator
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.PeerId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field AccountIdentity", wireType) return fmt.Errorf("proto: wrong wireType = %d for field AccountIdentity", wireType)
} }
@ -1086,7 +1140,7 @@ func (m *SpaceReceipt) Unmarshal(dAtA []byte) error {
m.AccountIdentity = []byte{} m.AccountIdentity = []byte{}
} }
iNdEx = postIndex iNdEx = postIndex
case 3: case 4:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ControlNodeIdentity", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ControlNodeIdentity", wireType)
} }
@ -1120,7 +1174,7 @@ func (m *SpaceReceipt) Unmarshal(dAtA []byte) error {
m.ControlNodeIdentity = []byte{} m.ControlNodeIdentity = []byte{}
} }
iNdEx = postIndex iNdEx = postIndex
case 4: case 5:
if wireType != 0 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidUntil", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ValidUntil", wireType)
} }

View File

@ -30,13 +30,16 @@ message SpaceReceiptWithSignature {
// SpaceReceipt contains permission to SpacePush operation // SpaceReceipt contains permission to SpacePush operation
message SpaceReceipt { message SpaceReceipt {
// spaceId
string spaceId = 1; string spaceId = 1;
// peerId of receipt requester
string peerId = 2;
// identity of space owner // identity of space owner
bytes accountIdentity = 2; bytes accountIdentity = 3;
// identity of control node // identity of control node
bytes controlNodeIdentity = 3; bytes controlNodeIdentity = 4;
// unix-timestamp with a deadline time of receipt validity // unix-timestamp with a deadline time of receipt validity
uint64 validUntil = 4; uint64 validUntil = 5;
} }
// FileLimitCheckRequest contains an account identity and spaceId // FileLimitCheckRequest contains an account identity and spaceId