2.4.4. Transaction Request
rpc Txn (TxnRequest) returns (TxnResponse) { }
message TxnRequest {
// List of tests to perform before transaction
repeated Compare compare = 1;
// List of operations to perform when all tests succeed
repeated RequestOp success = 2;
// List of operations to perform when any test fails
repeated RequestOp failure = 3;
}
message Compare {
enum CompareResult {
EQUAL = 0;
GREATER = 1;
LESS = 2;
NOT_EQUAL = 3;
}
enum CompareTarget {
VERSION = 0;
CREATE = 1;
MOD = 2;
VALUE = 3;
LEASE = 4;
}
CompareResult result = 1;
CompareTarget target = 2;
bytes key = 3;
oneof target_union {
int64 version = 4;
int64 create_revision = 5;
int64 mod_revision = 6;
bytes value = 7;
int64 lease = 8;
}
// Can compare key range rather than just one key
bytes range_end = 64;
}
message RequestOp {
oneof request {
RangeRequest request_range = 1;
PutRequest request_put = 2;
DeleteRangeRequest request_delete_range = 3;
TxnRequest request_txn = 4;
}
}
message TxnResponse {
ResponseHeader header = 1;
bool succeeded = 2;
repeated ResponseOp responses = 3;
}