Skip to content

Commit

Permalink
refactor: use a custom OptionalU64 to replace optional uint64
Browse files Browse the repository at this point in the history
Signed-off-by: bsbds <[email protected]>
  • Loading branch information
bsbds committed Aug 1, 2024
1 parent 7e2813c commit 2d81c8f
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/curp-command.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ option java_package = "com.curp.protobuf";
option java_outer_classname = "CommandProto";
option java_multiple_files = true;

// For compatibility of gRPC implementations that do not support the `optional`
// keyword
message OptionalU64 {
uint64 value = 1;
}

message ProposeId {
uint64 client_id = 1;
uint64 seq_num = 2;
Expand Down Expand Up @@ -50,8 +56,8 @@ message CmdResult {
// Please add comments above your error if you want to extend more :)
message CurpError {
message Redirect {
optional uint64 leader_id = 1;
uint64 term = 2;
OptionalU64 leader_id = 1;
uint64 term = 2;
}
oneof err {
// When a command conflicts with the server SP.
Expand Down Expand Up @@ -128,11 +134,11 @@ message FetchClusterRequest {
}

message FetchClusterResponse {
optional uint64 leader_id = 1;
uint64 term = 2;
uint64 cluster_id = 3;
repeated Member members = 4;
uint64 cluster_version = 5;
OptionalU64 leader_id = 1;
uint64 term = 2;
uint64 cluster_id = 3;
repeated Member members = 4;
uint64 cluster_version = 5;
}

message FetchReadStateRequest {
Expand Down

0 comments on commit 2d81c8f

Please sign in to comment.