diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-08 12:44:00 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-13 09:47:19 +0300 |
commit | 0c08541cf496d76c5611ee1e7bcfc49724dbcc21 (patch) | |
tree | 29b68a66844035f3aff356eee866657fdda04a87 /proto | |
parent | dac1c323929b21e9ab0fc98af3e79dec3495b2a0 (diff) |
proto: Introduce transactional voting phases
Transactional votes currently only contain information about the vote
that we actually want to cast, but it doesn't contain any sort of
metadata which would allow us to more precisely track the nature of a
specific vote. Most importantly, while we already use "preparatory" and
"committing" votes in almost all places, they are only preparatory and
committing votes by convention: there is no metadata which would allow
us to discern these cases.
Amend the voting RPC call to use "phases", which currently knows three
different phases:
- "unknown": this is the current default which we'll need to support
until all voting callsites have been converted to use proper
phases.
- "prepared": the change has been prepared to be committed. Locks
have been taken already, but no change has yet been committed to
disk such that they would be visible to the user.
- "committed": changes have been committed to disk and are thus both
persistent and visible to the user.
With these phases, we can eventually build additional logic into
Praefect which makes use of them. This includes creating less
replication jobs if no change was committed, making two-phase voting a
necessity instead of a convention, and potentially others.
Changelog: added
Diffstat (limited to 'proto')
-rw-r--r-- | proto/go/gitalypb/transaction.pb.go | 196 | ||||
-rw-r--r-- | proto/transaction.proto | 16 |
2 files changed, 152 insertions, 60 deletions
diff --git a/proto/go/gitalypb/transaction.pb.go b/proto/go/gitalypb/transaction.pb.go index 24e8aaab8..7910a01d1 100644 --- a/proto/go/gitalypb/transaction.pb.go +++ b/proto/go/gitalypb/transaction.pb.go @@ -20,6 +20,63 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type VoteTransactionRequest_Phase int32 + +const ( + // 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. + VoteTransactionRequest_UNKNOWN_PHASE VoteTransactionRequest_Phase = 0 + // 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. + VoteTransactionRequest_PREPARED_PHASE VoteTransactionRequest_Phase = 1 + // COMMITTED_PHASE is the committing phase. Data has been committed to disk + // and will be visible in all subsequent requests. + VoteTransactionRequest_COMMITTED_PHASE VoteTransactionRequest_Phase = 2 +) + +// Enum value maps for VoteTransactionRequest_Phase. +var ( + VoteTransactionRequest_Phase_name = map[int32]string{ + 0: "UNKNOWN_PHASE", + 1: "PREPARED_PHASE", + 2: "COMMITTED_PHASE", + } + VoteTransactionRequest_Phase_value = map[string]int32{ + "UNKNOWN_PHASE": 0, + "PREPARED_PHASE": 1, + "COMMITTED_PHASE": 2, + } +) + +func (x VoteTransactionRequest_Phase) Enum() *VoteTransactionRequest_Phase { + p := new(VoteTransactionRequest_Phase) + *p = x + return p +} + +func (x VoteTransactionRequest_Phase) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VoteTransactionRequest_Phase) Descriptor() protoreflect.EnumDescriptor { + return file_transaction_proto_enumTypes[0].Descriptor() +} + +func (VoteTransactionRequest_Phase) Type() protoreflect.EnumType { + return &file_transaction_proto_enumTypes[0] +} + +func (x VoteTransactionRequest_Phase) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VoteTransactionRequest_Phase.Descriptor instead. +func (VoteTransactionRequest_Phase) EnumDescriptor() ([]byte, []int) { + return file_transaction_proto_rawDescGZIP(), []int{0, 0} +} + // The outcome of the given transaction telling the client whether the // transaction should be committed or rolled back. type VoteTransactionResponse_TransactionState int32 @@ -55,11 +112,11 @@ func (x VoteTransactionResponse_TransactionState) String() string { } func (VoteTransactionResponse_TransactionState) Descriptor() protoreflect.EnumDescriptor { - return file_transaction_proto_enumTypes[0].Descriptor() + return file_transaction_proto_enumTypes[1].Descriptor() } func (VoteTransactionResponse_TransactionState) Type() protoreflect.EnumType { - return &file_transaction_proto_enumTypes[0] + return &file_transaction_proto_enumTypes[1] } func (x VoteTransactionResponse_TransactionState) Number() protoreflect.EnumNumber { @@ -83,6 +140,8 @@ type VoteTransactionRequest struct { Node string `protobuf:"bytes,3,opt,name=node,proto3" json:"node,omitempty"` // SHA1 of the references that are to be updated ReferenceUpdatesHash []byte `protobuf:"bytes,4,opt,name=reference_updates_hash,json=referenceUpdatesHash,proto3" json:"reference_updates_hash,omitempty"` + // Phase is the voting phase. + Phase VoteTransactionRequest_Phase `protobuf:"varint,5,opt,name=phase,proto3,enum=gitaly.VoteTransactionRequest_Phase" json:"phase,omitempty"` } func (x *VoteTransactionRequest) Reset() { @@ -145,6 +204,13 @@ func (x *VoteTransactionRequest) GetReferenceUpdatesHash() []byte { return nil } +func (x *VoteTransactionRequest) GetPhase() VoteTransactionRequest_Phase { + if x != nil { + return x.Phase + } + return VoteTransactionRequest_UNKNOWN_PHASE +} + type VoteTransactionResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -292,7 +358,7 @@ var file_transaction_proto_rawDesc = []byte{ 0x0a, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x1a, 0x0a, 0x6c, 0x69, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc3, 0x01, 0x0a, 0x16, 0x56, 0x6f, 0x74, 0x65, 0x54, 0x72, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc4, 0x02, 0x0a, 0x16, 0x56, 0x6f, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, @@ -304,43 +370,51 @@ var file_transaction_proto_rawDesc = []byte{ 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x14, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x48, 0x61, 0x73, 0x68, 0x22, 0x96, 0x01, 0x0a, 0x17, - 0x56, 0x6f, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, - 0x56, 0x6f, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, - 0x33, 0x0a, 0x10, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4f, 0x4d, 0x4d, 0x49, 0x54, 0x10, 0x00, 0x12, - 0x09, 0x0a, 0x05, 0x41, 0x42, 0x4f, 0x52, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x54, - 0x4f, 0x50, 0x10, 0x02, 0x22, 0x79, 0x0a, 0x16, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, - 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x70, 0x6f, - 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x04, 0x98, 0xc6, 0x2c, 0x01, 0x52, 0x0a, 0x72, 0x65, - 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x6e, - 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, - 0x19, 0x0a, 0x17, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc8, 0x01, 0x0a, 0x0e, 0x52, - 0x65, 0x66, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5a, 0x0a, - 0x0f, 0x56, 0x6f, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x1e, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x54, 0x72, - 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1f, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x54, 0x72, - 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x01, 0x12, 0x5a, 0x0a, 0x0f, 0x53, 0x74, 0x6f, - 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x67, - 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, - 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xfa, - 0x97, 0x28, 0x02, 0x08, 0x01, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x67, - 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2f, 0x76, 0x31, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x67, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3a, 0x0a, 0x05, 0x70, + 0x68, 0x61, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x69, 0x74, + 0x61, 0x6c, 0x79, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x68, 0x61, 0x73, 0x65, + 0x52, 0x05, 0x70, 0x68, 0x61, 0x73, 0x65, 0x22, 0x43, 0x0a, 0x05, 0x50, 0x68, 0x61, 0x73, 0x65, + 0x12, 0x11, 0x0a, 0x0d, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x50, 0x48, 0x41, 0x53, + 0x45, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x50, 0x52, 0x45, 0x50, 0x41, 0x52, 0x45, 0x44, 0x5f, + 0x50, 0x48, 0x41, 0x53, 0x45, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x43, 0x4f, 0x4d, 0x4d, 0x49, + 0x54, 0x54, 0x45, 0x44, 0x5f, 0x50, 0x48, 0x41, 0x53, 0x45, 0x10, 0x02, 0x22, 0x96, 0x01, 0x0a, + 0x17, 0x56, 0x6f, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, + 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, + 0x22, 0x33, 0x0a, 0x10, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4f, 0x4d, 0x4d, 0x49, 0x54, 0x10, 0x00, + 0x12, 0x09, 0x0a, 0x05, 0x41, 0x42, 0x4f, 0x52, 0x54, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x53, + 0x54, 0x4f, 0x50, 0x10, 0x02, 0x22, 0x79, 0x0a, 0x16, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x38, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x04, 0x98, 0xc6, 0x2c, 0x01, 0x52, 0x0a, 0x72, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x22, 0x19, 0x0a, 0x17, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc8, 0x01, 0x0a, 0x0e, + 0x52, 0x65, 0x66, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x5a, + 0x0a, 0x0f, 0x56, 0x6f, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1e, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x01, 0x12, 0x5a, 0x0a, 0x0f, 0x53, 0x74, + 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, + 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, + 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, + 0xfa, 0x97, 0x28, 0x02, 0x08, 0x01, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2d, 0x6f, 0x72, 0x67, 0x2f, + 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2f, 0x76, 0x31, 0x34, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -355,29 +429,31 @@ func file_transaction_proto_rawDescGZIP() []byte { return file_transaction_proto_rawDescData } -var file_transaction_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_transaction_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_transaction_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_transaction_proto_goTypes = []interface{}{ - (VoteTransactionResponse_TransactionState)(0), // 0: gitaly.VoteTransactionResponse.TransactionState - (*VoteTransactionRequest)(nil), // 1: gitaly.VoteTransactionRequest - (*VoteTransactionResponse)(nil), // 2: gitaly.VoteTransactionResponse - (*StopTransactionRequest)(nil), // 3: gitaly.StopTransactionRequest - (*StopTransactionResponse)(nil), // 4: gitaly.StopTransactionResponse - (*Repository)(nil), // 5: gitaly.Repository + (VoteTransactionRequest_Phase)(0), // 0: gitaly.VoteTransactionRequest.Phase + (VoteTransactionResponse_TransactionState)(0), // 1: gitaly.VoteTransactionResponse.TransactionState + (*VoteTransactionRequest)(nil), // 2: gitaly.VoteTransactionRequest + (*VoteTransactionResponse)(nil), // 3: gitaly.VoteTransactionResponse + (*StopTransactionRequest)(nil), // 4: gitaly.StopTransactionRequest + (*StopTransactionResponse)(nil), // 5: gitaly.StopTransactionResponse + (*Repository)(nil), // 6: gitaly.Repository } var file_transaction_proto_depIdxs = []int32{ - 5, // 0: gitaly.VoteTransactionRequest.repository:type_name -> gitaly.Repository - 0, // 1: gitaly.VoteTransactionResponse.state:type_name -> gitaly.VoteTransactionResponse.TransactionState - 5, // 2: gitaly.StopTransactionRequest.repository:type_name -> gitaly.Repository - 1, // 3: gitaly.RefTransaction.VoteTransaction:input_type -> gitaly.VoteTransactionRequest - 3, // 4: gitaly.RefTransaction.StopTransaction:input_type -> gitaly.StopTransactionRequest - 2, // 5: gitaly.RefTransaction.VoteTransaction:output_type -> gitaly.VoteTransactionResponse - 4, // 6: gitaly.RefTransaction.StopTransaction:output_type -> gitaly.StopTransactionResponse - 5, // [5:7] is the sub-list for method output_type - 3, // [3:5] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 6, // 0: gitaly.VoteTransactionRequest.repository:type_name -> gitaly.Repository + 0, // 1: gitaly.VoteTransactionRequest.phase:type_name -> gitaly.VoteTransactionRequest.Phase + 1, // 2: gitaly.VoteTransactionResponse.state:type_name -> gitaly.VoteTransactionResponse.TransactionState + 6, // 3: gitaly.StopTransactionRequest.repository:type_name -> gitaly.Repository + 2, // 4: gitaly.RefTransaction.VoteTransaction:input_type -> gitaly.VoteTransactionRequest + 4, // 5: gitaly.RefTransaction.StopTransaction:input_type -> gitaly.StopTransactionRequest + 3, // 6: gitaly.RefTransaction.VoteTransaction:output_type -> gitaly.VoteTransactionResponse + 5, // 7: gitaly.RefTransaction.StopTransaction:output_type -> gitaly.StopTransactionResponse + 6, // [6:8] is the sub-list for method output_type + 4, // [4:6] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_transaction_proto_init() } @@ -442,7 +518,7 @@ func file_transaction_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_transaction_proto_rawDesc, - NumEnums: 1, + NumEnums: 2, NumMessages: 4, NumExtensions: 0, NumServices: 1, diff --git a/proto/transaction.proto b/proto/transaction.proto index 745a764a5..3d3e48de5 100644 --- a/proto/transaction.proto +++ b/proto/transaction.proto @@ -26,6 +26,20 @@ service RefTransaction { } message VoteTransactionRequest { + 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; + // 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; + // COMMITTED_PHASE is the committing phase. Data has been committed to disk + // and will be visible in all subsequent requests. + COMMITTED_PHASE = 2; + }; + Repository repository = 1[(target_repository)=true]; // ID of the transaction we're processing uint64 transaction_id = 2; @@ -33,6 +47,8 @@ message VoteTransactionRequest { 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; } message VoteTransactionResponse { |