diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2021-07-26 13:09:49 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2021-07-29 13:28:14 +0300 |
commit | 241290c104d58ebb88d01bc9704fd94d4e705ab2 (patch) | |
tree | 84079a8f44ff9e5378e5b0b8039312ffaa50fc4a /ruby | |
parent | bf55b6fc1a0c9bba1e9d1af29cf4ccab168d30e0 (diff) |
gitaly: Sort the tags returned by FindAllTags RPC
The gitlab uses FindAllTags to fetch all tags and it requires
to do sorting in-memory after fetch. By this change we provide
ability to sort tags on the gitaly side by: tag name or creation
date in ascending or descending order.
The default remains the same as if no sorting requested - sort by
tag name, so it should not affect any existing clients.
Closes: https://gitlab.com/gitlab-org/gitaly/-/issues/3592
Changelog: added
Diffstat (limited to 'ruby')
-rw-r--r-- | ruby/proto/gitaly/ref_pb.rb | 11 | ||||
-rw-r--r-- | ruby/proto/gitaly/ref_services_pb.rb | 1 | ||||
-rw-r--r-- | ruby/proto/gitaly/shared_pb.rb | 5 |
3 files changed, 17 insertions, 0 deletions
diff --git a/ruby/proto/gitaly/ref_pb.rb b/ruby/proto/gitaly/ref_pb.rb index 086eaf9a4..b2a833d12 100644 --- a/ruby/proto/gitaly/ref_pb.rb +++ b/ruby/proto/gitaly/ref_pb.rb @@ -91,6 +91,15 @@ Google::Protobuf::DescriptorPool.generated_pool.build do end add_message "gitaly.FindAllTagsRequest" do optional :repository, :message, 1, "gitaly.Repository" + optional :sort_by, :message, 2, "gitaly.FindAllTagsRequest.SortBy" + end + add_message "gitaly.FindAllTagsRequest.SortBy" do + optional :key, :enum, 1, "gitaly.FindAllTagsRequest.SortBy.Key" + optional :direction, :enum, 2, "gitaly.SortDirection" + end + add_enum "gitaly.FindAllTagsRequest.SortBy.Key" do + value :NAME, 0 + value :UPDATED, 1 end add_message "gitaly.FindAllTagsResponse" do repeated :tags, :message, 1, "gitaly.Tag" @@ -219,6 +228,8 @@ module Gitaly FindTagRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.FindTagRequest").msgclass FindTagResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.FindTagResponse").msgclass FindAllTagsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.FindAllTagsRequest").msgclass + FindAllTagsRequest::SortBy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.FindAllTagsRequest.SortBy").msgclass + FindAllTagsRequest::SortBy::Key = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.FindAllTagsRequest.SortBy.Key").enummodule FindAllTagsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.FindAllTagsResponse").msgclass RefExistsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.RefExistsRequest").msgclass RefExistsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.RefExistsResponse").msgclass diff --git a/ruby/proto/gitaly/ref_services_pb.rb b/ruby/proto/gitaly/ref_services_pb.rb index 81563d116..8d01f5118 100644 --- a/ruby/proto/gitaly/ref_services_pb.rb +++ b/ruby/proto/gitaly/ref_services_pb.rb @@ -22,6 +22,7 @@ module Gitaly # Return a stream so we can divide the response in chunks of branches rpc :FindLocalBranches, ::Gitaly::FindLocalBranchesRequest, stream(::Gitaly::FindLocalBranchesResponse) rpc :FindAllBranches, ::Gitaly::FindAllBranchesRequest, stream(::Gitaly::FindAllBranchesResponse) + # Returns a stream of tags repository has. rpc :FindAllTags, ::Gitaly::FindAllTagsRequest, stream(::Gitaly::FindAllTagsResponse) rpc :FindTag, ::Gitaly::FindTagRequest, ::Gitaly::FindTagResponse rpc :FindAllRemoteBranches, ::Gitaly::FindAllRemoteBranchesRequest, stream(::Gitaly::FindAllRemoteBranchesResponse) diff --git a/ruby/proto/gitaly/shared_pb.rb b/ruby/proto/gitaly/shared_pb.rb index 51e0fbc6c..f96d86356 100644 --- a/ruby/proto/gitaly/shared_pb.rb +++ b/ruby/proto/gitaly/shared_pb.rb @@ -85,6 +85,10 @@ Google::Protobuf::DescriptorPool.generated_pool.build do value :PGP, 1 value :X509, 2 end + add_enum "gitaly.SortDirection" do + value :ASCENDING, 0 + value :DESCENDING, 1 + end end end @@ -103,4 +107,5 @@ module Gitaly GlobalOptions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.GlobalOptions").msgclass ObjectType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.ObjectType").enummodule SignatureType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.SignatureType").enummodule + SortDirection = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.SortDirection").enummodule end |