diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2017-07-10 05:43:20 +0200 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2017-07-11 16:55:00 +0200 |
commit | 08ce213c410aa6c6d48fddc2de79accc094564a9 (patch) | |
tree | 5c69c46db421211752ecfe1c375c7da883e844b5 /lib/gitlab/workhorse.rb | |
parent | 64701b51aeacf4f4f932f205a2d831880b757a43 (diff) | |
download | gitlab-ce-08ce213c410aa6c6d48fddc2de79accc094564a9.tar.gz |
Migrate Workhorse SendBlob to Gitaly
Diffstat (limited to 'lib/gitlab/workhorse.rb')
-rw-r--r-- | lib/gitlab/workhorse.rb | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb index 4aef23b6aee..d4829272c93 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 |