syntax = "proto2"; package rasputin; // // Client <-> rasputin server messages // message SetReq { required bytes key = 1; required bytes value = 2; } message SetRes { required bool success = 1; required uint64 txid = 2; optional string err = 3; } message GetReq { required bytes key = 1; } message GetRes { required bool success = 1; required uint64 txid = 2; optional bytes value = 3; optional string err = 4; } message CASReq { required bytes key = 1; optional bytes new_value = 2; optional bytes old_value = 3; } message CASRes { required bool success = 1; required uint64 txid = 2; optional bytes value = 3; optional string err = 4; } message DelReq { required bytes key = 1; } message DelRes { required bool success = 1; required uint64 txid = 2; required bytes value = 3; optional string err = 4; } message WatchReq { required bytes key = 1; required uint64 last_txid = 2; required bool recursive = 3; required bool historical = 4; } message WatchRes { required bool success = 1; repeated Mutation history = 2; optional string err = 3; } message RedirectRes { required bool success = 1; optional string address = 2; optional string err = 3; } // datatypes enum MutationType { KVSET = 1; KVCAS = 2; KVDEL = 3; } message Mutation { required MutationType type = 1; required Version version = 2; required bytes key = 3; optional bytes value = 4; optional bytes old_value = 5; } message Version { required uint64 txid = 1; required uint64 term = 2; } // client top-levl API message CliReq { required uint64 req_id = 1; optional GetReq get = 2; optional SetReq set = 3; optional CASReq cas = 4; optional DelReq del = 5; optional WatchReq watch = 6; } message CliRes { required uint64 req_id = 1; optional GetRes get = 2; optional SetRes set = 3; optional CASRes cas = 4; optional DelRes del = 5; optional WatchRes watch = 6; optional RedirectRes redirect = 7; } // // Leadership // message VoteReq { required uint64 term = 1; required uint64 last_learned_term = 2; required uint64 last_learned_txid = 3; required uint64 last_accepted_term = 4; required uint64 last_accepted_txid = 5; } message VoteRes { required bool success = 1; required uint64 term = 2; } // // Replication // message Append { required uint64 from_txid = 1; required uint64 from_term = 2; repeated Mutation batch = 3; required uint64 last_learned_txid = 4; } message AppendRes { required bool accepted = 1; optional uint64 last_accepted_txid = 2; optional uint64 last_accepted_term = 3; } // server<->server top-level api message PeerMsg { required string srvid = 1; optional VoteReq vote_req = 2; optional VoteRes vote_res = 3; optional Append append = 4; optional AppendRes append_res = 5; }