1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
|
syntax = "proto3";
package gitaly;
import "lint.proto";
import "shared.proto";
option go_package = "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb";
// RefTransaction is a service which provides RPCs to interact with reference
// transactions. Reference transactions are used in the context of Gitaly
// Cluster to ensure that all nodes part of a single transaction perform the
// same change: given a set of changes, the changes are hashed and the hash is
// then voted on.
service RefTransaction {
option (intercepted) = true;
// VoteTransaction casts a vote on a transaction to establish whether the
// node is doing the same change as all the other nodes part of the
// transaction. This RPC blocks until quorum has been reached, which may be
// _before_ all nodes have cast a vote.
//
// This RPC may return one of the following error codes:
//
// - `NotFound` in case the transaction could not be found.
// - `Canceled` in case the transaction has been canceled before quorum was
// reached.
rpc VoteTransaction (VoteTransactionRequest) returns (VoteTransactionResponse);
// StopTransaction gracefully stops a transaction. This RPC can be used if
// only a subset of nodes executes specific code which may cause the
// transaction to fail. One such example is Git hooks, which only execute on
// the primary Gitaly noded. Other nodes which vote on this transaction will
// get a response with the `STOP` state being set.
//
// This RPC may return one of the following error codes:
//
// - `NotFound` in case the transaction could not be found.
// - `Canceled` in case the transaction has been canceled before quorum was
// reached.
rpc StopTransaction (StopTransactionRequest) returns (StopTransactionResponse);
}
// This comment is left unintentionally blank.
message VoteTransactionRequest {
// This comment is left unintentionally blank.
enum Phase {
// UNKNOWN_PHASE is the unknown voting phase. This value has been the
// default because phases have been introduced. Eventually, using this
// phase will become unsupported.
UNKNOWN_PHASE = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
// PREPARED_PHASE is the prepratory phase. The data that is about to change
// is locked for concurrent modification, but changes have not yet been
// written to disk.
PREPARED_PHASE = 1; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
// COMMITTED_PHASE is the committing phase. Data has been committed to disk
// and will be visible in all subsequent requests.
COMMITTED_PHASE = 2; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
// SYNCHRONIZED_PHASE is the synchronizing phase. This is used to synchronize nodes with each other on a
// specific event.
SYNCHRONIZED_PHASE = 3; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
};
// This comment is left unintentionally blank.
Repository repository = 1[(target_repository)=true];
// ID of the transaction we're processing
uint64 transaction_id = 2;
// Name of the Gitaly node that's voting on a transaction.
string node = 3;
// SHA1 of the references that are to be updated
bytes reference_updates_hash = 4;
// Phase is the voting phase.
Phase phase = 5;
}
// This comment is left unintentionally blank.
message VoteTransactionResponse {
// The outcome of the given transaction telling the client whether the
// transaction should be committed or rolled back.
enum TransactionState {
// This comment is left unintentionally blank.
COMMIT = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
// This comment is left unintentionally blank.
ABORT = 1; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
// This comment is left unintentionally blank.
STOP = 2; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
}
// This comment is left unintentionally blank.
TransactionState state = 1;
}
// This comment is left unintentionally blank.
message StopTransactionRequest {
// This comment is left unintentionally blank.
Repository repository = 1[(target_repository)=true];
// ID of the transaction we're processing
uint64 transaction_id = 2;
}
// This comment is left unintentionally blank.
message StopTransactionResponse {
}
|