diff --git a/src/curp-command.proto b/src/curp-command.proto index 09e479f..9bf64a1 100644 --- a/src/curp-command.proto +++ b/src/curp-command.proto @@ -99,6 +99,8 @@ 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; } } @@ -106,12 +108,40 @@ 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 + 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 { @@ -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);