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
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-07-12 19:57:57 +0300
committerRobert Speicher <robert@gitlab.com>2017-07-12 19:57:57 +0300
commit9bfe49c2b14e102676b2d528b230d6e4a88425a1 (patch)
tree262ea85a705886f0e5e2ce8ac7b444d6f21aeb58 /lib/gitlab/workhorse.rb
parent777ec2106415f464c3fe98643a41e847861fede3 (diff)
parent08ce213c410aa6c6d48fddc2de79accc094564a9 (diff)
Merge branch 'migrate-workhorse-send-blob-to-gitaly' into 'master'
Migrate Workhorse SendBlob to Gitaly Closes gitaly#356 See merge request !12313
Diffstat (limited to 'lib/gitlab/workhorse.rb')
-rw-r--r--lib/gitlab/workhorse.rb26
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb
index ee4f2b773ea..916ef365d78 100644
--- a/lib/gitlab/workhorse.rb
+++ b/lib/gitlab/workhorse.rb
@@ -62,10 +62,21 @@ module Gitlab
end
def send_git_blob(repository, blob)
- params = {
- 'RepoPath' => repository.path_to_repo,
- 'BlobId' => blob.id
- }
+ params = if Gitlab::GitalyClient.feature_enabled?(:project_raw_show)
+ {
+ 'GitalyServer' => gitaly_server_hash(repository),
+ 'GetBlobRequest' => {
+ repository: repository.gitaly_repository.to_h,
+ oid: blob.id,
+ limit: -1
+ }
+ }
+ else
+ {
+ 'RepoPath' => repository.path_to_repo,
+ 'BlobId' => blob.id
+ }
+ end
[
SEND_DATA_HEADER,
@@ -192,6 +203,13 @@ module Gitlab
def encode(hash)
Base64.urlsafe_encode64(JSON.dump(hash))
end
+
+ def gitaly_server_hash(repository)
+ {
+ address: Gitlab::GitalyClient.address(repository.project.repository_storage),
+ token: Gitlab::GitalyClient.token(repository.project.repository_storage)
+ }
+ end
end
end
end