diff options
author | Will Chandler <wchandler@gitlab.com> | 2022-10-14 20:17:23 +0300 |
---|---|---|
committer | Will Chandler <wchandler@gitlab.com> | 2022-10-14 20:39:12 +0300 |
commit | 738d6c1485c707f4a9f8c776068ebd59dcc77d22 (patch) | |
tree | c2d7cb3a8f68083405dcafb0ee2af80ff92e7f31 /ruby/proto | |
parent | d12fc2976d0d1c4c575c266757cade35e634b206 (diff) |
proto: Add UserCommitFilesError
Add a new `UserCommitFilesError` message type that will be used to add
structured errors to the `UserCommitFiles` RPC. This necessitates
creating a new `IndexError` error type to enumerates the type of index
operations that may fail.
We limit `IndexError` to a single path despite a potentially large
number of files being modified because we end the RPC on the first
failure, so any subsequent paths that would have failed are not
encountered. `path` is sent as `bytes` in the proto because file paths
are not guaranteed to be valid UTF-8 by many common filesytems, which is
the required encoding for protobuf strings.
Diffstat (limited to 'ruby/proto')
-rw-r--r-- | ruby/proto/gitaly/errors_pb.rb | 15 | ||||
-rw-r--r-- | ruby/proto/gitaly/operations_pb.rb | 8 |
2 files changed, 23 insertions, 0 deletions
diff --git a/ruby/proto/gitaly/errors_pb.rb b/ruby/proto/gitaly/errors_pb.rb index 1691cc760..77600fbf7 100644 --- a/ruby/proto/gitaly/errors_pb.rb +++ b/ruby/proto/gitaly/errors_pb.rb @@ -12,6 +12,19 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :user_id, :string, 3 optional :changes, :bytes, 4 end + add_message "gitaly.IndexError" do + optional :path, :bytes, 1 + optional :error_type, :enum, 2, "gitaly.IndexError.ErrorType" + end + add_enum "gitaly.IndexError.ErrorType" do + value :ERROR_TYPE_UNSPECIFIED, 0 + value :ERROR_TYPE_EMPTY_PATH, 1 + value :ERROR_TYPE_INVALID_PATH, 2 + value :ERROR_TYPE_DIRECTORY_EXISTS, 3 + value :ERROR_TYPE_DIRECTORY_TRAVERSAL, 4 + value :ERROR_TYPE_FILE_EXISTS, 5 + value :ERROR_TYPE_FILE_NOT_FOUND, 6 + end add_message "gitaly.InvalidRefFormatError" do repeated :refs, :bytes, 2 end @@ -63,6 +76,8 @@ end module Gitaly AccessCheckError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.AccessCheckError").msgclass + IndexError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.IndexError").msgclass + IndexError::ErrorType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.IndexError.ErrorType").enummodule InvalidRefFormatError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.InvalidRefFormatError").msgclass NotAncestorError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.NotAncestorError").msgclass ChangesAlreadyAppliedError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.ChangesAlreadyAppliedError").msgclass diff --git a/ruby/proto/gitaly/operations_pb.rb b/ruby/proto/gitaly/operations_pb.rb index 99e650397..de5149965 100644 --- a/ruby/proto/gitaly/operations_pb.rb +++ b/ruby/proto/gitaly/operations_pb.rb @@ -228,6 +228,13 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :index_error, :string, 2 optional :pre_receive_error, :string, 3 end + add_message "gitaly.UserCommitFilesError" do + oneof :error do + optional :access_check, :message, 1, "gitaly.AccessCheckError" + optional :index_update, :message, 2, "gitaly.IndexError" + optional :custom_hook, :message, 3, "gitaly.CustomHookError" + end + end add_message "gitaly.UserRebaseConfirmableRequest" do oneof :user_rebase_confirmable_request_payload do optional :header, :message, 1, "gitaly.UserRebaseConfirmableRequest.Header" @@ -344,6 +351,7 @@ module Gitaly UserCommitFilesRequestHeader = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.UserCommitFilesRequestHeader").msgclass UserCommitFilesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.UserCommitFilesRequest").msgclass UserCommitFilesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.UserCommitFilesResponse").msgclass + UserCommitFilesError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.UserCommitFilesError").msgclass UserRebaseConfirmableRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.UserRebaseConfirmableRequest").msgclass UserRebaseConfirmableRequest::Header = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.UserRebaseConfirmableRequest.Header").msgclass UserRebaseConfirmableResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.UserRebaseConfirmableResponse").msgclass |