From 810e6a261dde1e19e945042d6679e4b3a3d3cfc2 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 23 Sep 2020 14:17:49 +0200 Subject: transactions: Expose RPC to gracefully stop transactions This commit adds the ability to stop transactions via the RefTransaction service. In contrast to state cancellation, this is considered to be a graceful stop of transactions: nodes which cast votes on stopped transactions are not supposed to treat it as an error if the transaction has been stopped, but should instead just terminate it and stop proceeding. To tell apart "real" errors from a stopped transaction, this commit thus adds a new "STOP" state which tells the client to stop processing it. --- proto/transaction.proto | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'proto/transaction.proto') diff --git a/proto/transaction.proto b/proto/transaction.proto index 1e7f1f5d7..fb11879c4 100644 --- a/proto/transaction.proto +++ b/proto/transaction.proto @@ -16,6 +16,13 @@ service RefTransaction { }; } + rpc StopTransaction (StopTransactionRequest) returns (StopTransactionResponse) { + option (op_type) = { + op: MUTATOR + scope_level: REPOSITORY + }; + } + } message VoteTransactionRequest { @@ -34,7 +41,16 @@ message VoteTransactionResponse { enum TransactionState { COMMIT = 0; ABORT = 1; + STOP = 2; } TransactionState state = 1; } + +message StopTransactionRequest { + Repository repository = 1[(target_repository)=true]; + // ID of the transaction we're processing + uint64 transaction_id = 2; +} + +message StopTransactionResponse {} -- cgit v1.2.3