diff options
author | John Cai <jcai@gitlab.com> | 2019-04-24 18:50:45 -0700 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2019-04-30 08:28:56 -0700 |
commit | 5ee7876534891df9c2f5ab6c5112cc47f98b1df5 (patch) | |
tree | cf9a3cf85b7404b7a815987b66951726a4618947 /lib | |
parent | fbaafdd767bc83b47ac4094a2865c8e84fae882c (diff) | |
download | gitlab-ce-5ee7876534891df9c2f5ab6c5112cc47f98b1df5.tar.gz |
Add client methods for FetchIntoObjectPool RPC
Gitaly's FetchIntoObjectPool RPC will idempotently fetch objects into an
object pool. If the pool doesn't exist, it will create an empty pool
before attempting the fetch. This change adds client code as well as
specs to cover this behavior.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/object_pool.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/gitaly_client/object_pool_service.rb | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/gitlab/git/object_pool.rb b/lib/gitlab/git/object_pool.rb index 8eb3c28ab70..d0577d7a4ff 100644 --- a/lib/gitlab/git/object_pool.rb +++ b/lib/gitlab/git/object_pool.rb @@ -40,6 +40,10 @@ module Gitlab @repository ||= Gitlab::Git::Repository.new(storage, relative_path, GL_REPOSITORY, gl_project_path) end + def fetch + object_pool_service.fetch(source_repository) + end + private def object_pool_service diff --git a/lib/gitlab/gitaly_client/object_pool_service.rb b/lib/gitlab/gitaly_client/object_pool_service.rb index ce1fb4d68ae..d7fac26bc13 100644 --- a/lib/gitlab/gitaly_client/object_pool_service.rb +++ b/lib/gitlab/gitaly_client/object_pool_service.rb @@ -33,6 +33,15 @@ module Gitlab GitalyClient.call(storage, :object_pool_service, :link_repository_to_object_pool, request, timeout: GitalyClient.fast_timeout) end + + def fetch(repository) + request = Gitaly::FetchIntoObjectPoolRequest.new( + object_pool: object_pool, + origin: repository.gitaly_repository + ) + + GitalyClient.call(storage, :object_pool_service, :fetch_into_object_pool, request) + end end end end |