Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-31 00:08:01 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-31 00:08:01 +0300
commit95ad46159e4cd93f2b31838199180d824e041994 (patch)
treed41880d3b6a0093463694978590e590efb08caef /lib
parent2c72daf2f1744f2b8c8c6674c266907e9ef55558 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/helpers/custom_validators.rb4
-rw-r--r--lib/gitlab/git/repository.rb10
-rw-r--r--lib/gitlab/gitaly_client/praefect_info_service.rb19
3 files changed, 31 insertions, 2 deletions
diff --git a/lib/api/helpers/custom_validators.rb b/lib/api/helpers/custom_validators.rb
index b4523d7b436..76f5fe555b4 100644
--- a/lib/api/helpers/custom_validators.rb
+++ b/lib/api/helpers/custom_validators.rb
@@ -38,7 +38,7 @@ module API
value = params[attr_name]
return if value.is_a?(Integer) ||
- [IssuableFinder::FILTER_NONE, IssuableFinder::FILTER_ANY].include?(value.to_s.downcase)
+ [IssuableFinder::Params::FILTER_NONE, IssuableFinder::Params::FILTER_ANY].include?(value.to_s.downcase)
raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)],
message: "should be an integer, 'None' or 'Any'"
@@ -50,7 +50,7 @@ module API
value = params[attr_name]
return if value.is_a?(Array) ||
- [IssuableFinder::FILTER_NONE, IssuableFinder::FILTER_ANY].include?(value.to_s.downcase)
+ [IssuableFinder::Params::FILTER_NONE, IssuableFinder::Params::FILTER_ANY].include?(value.to_s.downcase)
raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)],
message: "should be an array, 'None' or 'Any'"
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 9adabd4e8fe..ed746163748 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -944,6 +944,10 @@ module Gitlab
Gitlab::GitalyClient::ConflictsService.new(self, our_commit_oid, their_commit_oid)
end
+ def praefect_info_client
+ @praefect_info_client ||= Gitlab::GitalyClient::PraefectInfoService.new(self)
+ end
+
def clean_stale_repository_files
wrapped_gitaly_errors do
gitaly_repository_client.cleanup if exists?
@@ -1019,6 +1023,12 @@ module Gitlab
raise NoRepository # Guard against data races.
end
+ def replicas
+ wrapped_gitaly_errors do
+ praefect_info_client.replicas
+ end
+ end
+
private
def empty_diff_stats
diff --git a/lib/gitlab/gitaly_client/praefect_info_service.rb b/lib/gitlab/gitaly_client/praefect_info_service.rb
new file mode 100644
index 00000000000..127f8cfbdf6
--- /dev/null
+++ b/lib/gitlab/gitaly_client/praefect_info_service.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module GitalyClient
+ class PraefectInfoService
+ def initialize(repository)
+ @repository = repository
+ @gitaly_repo = repository.gitaly_repository
+ @storage = repository.storage
+ end
+
+ def replicas
+ request = Gitaly::RepositoryReplicasRequest.new(repository: @gitaly_repo)
+
+ GitalyClient.call(@storage, :praefect_info_service, :repository_replicas, request, timeout: GitalyClient.fast_timeout)
+ end
+ end
+ end
+end