Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update curp proto #27

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions src/curp-command.proto
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,49 @@ message CurpError {
string Internal = 12;
// When the leader is transferring or an error occurred in the transfer
string LeaderTransfer = 13;
// When the leader is a zombie
google.protobuf.Empty Zombie = 14;
}
}

message ProposeRequest {
ProposeId propose_id = 1;
// The serialized command
// The original type is `Command`
bytes command = 2;
uint64 cluster_version = 3;
bytes command = 2;
uint64 cluster_version = 3;
uint64 term = 4;
bool slow_path = 5;
uint64 first_incomplete = 6;
}

message ProposeResponse {
CmdResult result = 1;
bool conflict = 2;
}

message SyncedResponse {
// The serialized command after sync result
// The original type is Result<Command::ASR, Command::Error>
CmdResult after_sync_result = 1;
}

message OpResponse {
oneof op {
ProposeResponse propose = 1;
SyncedResponse synced = 2;
}
}

message RecordRequest {
ProposeId propose_id = 1;
// The serialized command
// The original type is `Command`
bytes command = 2;
}

message RecordResponse {
bool conflict = 1;
}

message WaitSyncedRequest {
Expand Down Expand Up @@ -205,10 +235,17 @@ message LeaseKeepAliveMsg {
uint64 client_id = 1;
}

message ReadIndexRequest {}

message ReadIndexResponse {
uint64 term = 1;
}

service Protocol {
// Unary
rpc Propose(ProposeRequest) returns (ProposeResponse);
rpc WaitSynced(WaitSyncedRequest) returns (WaitSyncedResponse);
rpc ProposeStream(ProposeRequest) returns (stream OpResponse);
rpc Record(RecordRequest) returns (RecordResponse);
rpc ReadIndex(ReadIndexRequest) returns (ReadIndexResponse);
rpc ProposeConfChange(ProposeConfChangeRequest)
returns (ProposeConfChangeResponse);
rpc Publish(PublishRequest) returns (PublishResponse);
Expand Down