feat: change piece number type from uint32 to int32 (#72)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2023-02-20 16:00:17 +08:00 committed by GitHub
parent 41e14b7c60
commit 11a152f294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -970,7 +970,7 @@ type Piece struct {
unknownFields protoimpl.UnknownFields
// Piece number.
Number uint32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
Number int32 `protobuf:"varint,1,opt,name=number,proto3" json:"number,omitempty"`
// Parent peer id.
ParentId string `protobuf:"bytes,2,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"`
// Piece offset.
@ -1019,7 +1019,7 @@ func (*Piece) Descriptor() ([]byte, []int) {
return file_pkg_apis_common_v2_common_proto_rawDescGZIP(), []int{5}
}
func (x *Piece) GetNumber() uint32 {
func (x *Piece) GetNumber() int32 {
if x != nil {
return x.Number
}
@ -1310,8 +1310,8 @@ var file_pkg_apis_common_v2_common_proto_rawDesc = []byte{
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a,
0x02, 0x38, 0x01, 0x22, 0x8d, 0x03, 0x0a, 0x05, 0x50, 0x69, 0x65, 0x63, 0x65, 0x12, 0x1f, 0x0a,
0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x07, 0xfa,
0x42, 0x04, 0x2a, 0x02, 0x28, 0x00, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x27,
0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x42, 0x07, 0xfa,
0x42, 0x04, 0x1a, 0x02, 0x28, 0x00, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x27,
0x0a, 0x09, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x72, 0x05, 0x10, 0x01, 0xd0, 0x01, 0x01, 0x52, 0x08, 0x70,
0x61, 0x72, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65,

View File

@ -232,7 +232,7 @@ message Download {
// Piece represents information of piece.
message Piece {
// Piece number.
uint32 number = 1 [(validate.rules).uint32.gte = 0];
int32 number = 1 [(validate.rules).int32.gte = 0];
// Parent peer id.
string parent_id = 2 [(validate.rules).string = {min_len: 1, ignore_empty: true}];
// Piece offset.

View File

@ -229,7 +229,7 @@ message Download {
// Piece represents information of piece.
message Piece {
// Piece number.
uint32 number = 1;
int32 number = 1;
// Parent peer id.
string parent_id = 2;
// Piece offset.

View File

@ -193,8 +193,8 @@ pub struct Download {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Piece {
/// Piece number.
#[prost(uint32, tag = "1")]
pub number: u32,
#[prost(int32, tag = "1")]
pub number: i32,
/// Parent peer id.
#[prost(string, tag = "2")]
pub parent_id: ::prost::alloc::string::String,