Class: Gitlab::GitalyClient::ObjectPoolService

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/gitaly_client/object_pool_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object_pool) ⇒ ObjectPoolService

Returns a new instance of ObjectPoolService.


8
9
10
11
# File 'lib/gitlab/gitaly_client/object_pool_service.rb', line 8

def initialize(object_pool)
  @object_pool = object_pool.gitaly_object_pool
  @storage = object_pool.storage
end

Instance Attribute Details

#object_poolObject (readonly)

Returns the value of attribute object_pool


6
7
8
# File 'lib/gitlab/gitaly_client/object_pool_service.rb', line 6

def object_pool
  @object_pool
end

#storageObject (readonly)

Returns the value of attribute storage


6
7
8
# File 'lib/gitlab/gitaly_client/object_pool_service.rb', line 6

def storage
  @storage
end

Instance Method Details

#create(repository) ⇒ Object


13
14
15
16
17
18
19
20
# File 'lib/gitlab/gitaly_client/object_pool_service.rb', line 13

def create(repository)
  request = Gitaly::CreateObjectPoolRequest.new(
    object_pool: object_pool,
    origin: repository.gitaly_repository)

  GitalyClient.call(storage, :object_pool_service, :create_object_pool,
                    request, timeout: GitalyClient.medium_timeout)
end

#deleteObject


22
23
24
25
26
27
# File 'lib/gitlab/gitaly_client/object_pool_service.rb', line 22

def delete
  request = Gitaly::DeleteObjectPoolRequest.new(object_pool: object_pool)

  GitalyClient.call(storage, :object_pool_service, :delete_object_pool,
                    request, timeout: GitalyClient.long_timeout)
end

#fetch(repository) ⇒ Object


39
40
41
42
43
44
45
46
47
# File 'lib/gitlab/gitaly_client/object_pool_service.rb', line 39

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, timeout: GitalyClient.long_timeout)
end

29
30
31
32
33
34
35
36
37
# File 'lib/gitlab/gitaly_client/object_pool_service.rb', line 29

def link_repository(repository)
  request = Gitaly::LinkRepositoryToObjectPoolRequest.new(
    object_pool: object_pool,
    repository: repository.gitaly_repository
  )

  GitalyClient.call(storage, :object_pool_service, :link_repository_to_object_pool,
                    request, timeout: GitalyClient.fast_timeout)
end