debian-mirror-gitlab/lib/gitlab/gitaly_client/object_pool_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.9 KiB
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
module Gitlab
module GitalyClient
class ObjectPoolService
2023-01-13 00:05:48 +05:30
include WithFeatureFlagActors
2019-02-15 15:39:39 +05:30
attr_reader :object_pool, :storage
def initialize(object_pool)
@object_pool = object_pool.gitaly_object_pool
@storage = object_pool.storage
end
def create(repository)
request = Gitaly::CreateObjectPoolRequest.new(
object_pool: object_pool,
origin: repository.gitaly_repository)
2023-01-13 00:05:48 +05:30
GitalyClient.with_feature_flag_actors(**gitaly_feature_flag_actors(repository)) do
GitalyClient.call(storage, :object_pool_service, :create_object_pool,
request, timeout: GitalyClient.medium_timeout)
end
2019-02-15 15:39:39 +05:30
end
def delete
request = Gitaly::DeleteObjectPoolRequest.new(object_pool: object_pool)
2019-12-21 20:55:43 +05:30
GitalyClient.call(storage, :object_pool_service, :delete_object_pool,
request, timeout: GitalyClient.long_timeout)
2019-02-15 15:39:39 +05:30
end
def link_repository(repository)
request = Gitaly::LinkRepositoryToObjectPoolRequest.new(
object_pool: object_pool,
repository: repository.gitaly_repository
)
2023-01-13 00:05:48 +05:30
GitalyClient.with_feature_flag_actors(**gitaly_feature_flag_actors(repository)) do
GitalyClient.call(storage, :object_pool_service, :link_repository_to_object_pool,
request, timeout: GitalyClient.fast_timeout)
end
2019-02-15 15:39:39 +05:30
end
2019-07-31 22:56:46 +05:30
def fetch(repository)
request = Gitaly::FetchIntoObjectPoolRequest.new(
object_pool: object_pool,
origin: repository.gitaly_repository
)
2023-01-13 00:05:48 +05:30
GitalyClient.with_feature_flag_actors(**gitaly_feature_flag_actors(repository)) do
GitalyClient.call(storage, :object_pool_service, :fetch_into_object_pool,
request, timeout: GitalyClient.long_timeout)
end
2019-07-31 22:56:46 +05:30
end
2019-02-15 15:39:39 +05:30
end
end
end