Class: Gitlab::Git::ObjectPool

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/git/object_pool.rb

Constant Summary collapse

GL_REPOSITORY =

GL_REPOSITORY has to be passed for Gitlab::Git::Repositories, but not used for ObjectPools.

""

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(storage, relative_path, source_repository, gl_project_path) ⇒ ObjectPool

Returns a new instance of ObjectPool.


15
16
17
18
19
20
# File 'lib/gitlab/git/object_pool.rb', line 15

def initialize(storage, relative_path, source_repository, gl_project_path)
  @storage = storage
  @relative_path = relative_path
  @source_repository = source_repository
  @gl_project_path = gl_project_path
end

Instance Attribute Details

#gl_project_pathObject (readonly)

Returns the value of attribute gl_project_path


13
14
15
# File 'lib/gitlab/git/object_pool.rb', line 13

def gl_project_path
  @gl_project_path
end

#relative_pathObject (readonly)

Returns the value of attribute relative_path


13
14
15
# File 'lib/gitlab/git/object_pool.rb', line 13

def relative_path
  @relative_path
end

#source_repositoryObject (readonly)

Returns the value of attribute source_repository


13
14
15
# File 'lib/gitlab/git/object_pool.rb', line 13

def source_repository
  @source_repository
end

#storageObject (readonly)

Returns the value of attribute storage


13
14
15
# File 'lib/gitlab/git/object_pool.rb', line 13

def storage
  @storage
end

Instance Method Details

#createObject


22
23
24
# File 'lib/gitlab/git/object_pool.rb', line 22

def create
  object_pool_service.create(source_repository)
end

#fetchObject


43
44
45
# File 'lib/gitlab/git/object_pool.rb', line 43

def fetch
  object_pool_service.fetch(source_repository)
end

#gitaly_object_poolObject


30
31
32
# File 'lib/gitlab/git/object_pool.rb', line 30

def gitaly_object_pool
  Gitaly::ObjectPool.new(repository: to_gitaly_repository)
end

26
27
28
# File 'lib/gitlab/git/object_pool.rb', line 26

def link(to_link_repo)
  object_pool_service.link_repository(to_link_repo)
end

#repositoryObject

Allows for reusing other RPCs by 'tricking' Gitaly to think its a repository


39
40
41
# File 'lib/gitlab/git/object_pool.rb', line 39

def repository
  @repository ||= Gitlab::Git::Repository.new(storage, relative_path, GL_REPOSITORY, gl_project_path)
end

#to_gitaly_repositoryObject


34
35
36
# File 'lib/gitlab/git/object_pool.rb', line 34

def to_gitaly_repository
  Gitlab::GitalyClient::Util.repository(storage, relative_path, GL_REPOSITORY, gl_project_path)
end