Class: Gitlab::Git::ObjectPool
- Inherits:
-
Object
- Object
- Gitlab::Git::ObjectPool
- 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
-
#gl_project_path ⇒ Object
readonly
Returns the value of attribute gl_project_path.
-
#relative_path ⇒ Object
readonly
Returns the value of attribute relative_path.
-
#source_repository ⇒ Object
readonly
Returns the value of attribute source_repository.
-
#storage ⇒ Object
readonly
Returns the value of attribute storage.
Class Method Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
- #fetch ⇒ Object
- #gitaly_object_pool ⇒ Object
-
#initialize(storage, relative_path, source_repository, gl_project_path) ⇒ ObjectPool
constructor
A new instance of ObjectPool.
- #link(to_link_repo) ⇒ Object
-
#repository ⇒ Object
Allows for reusing other RPCs by ‘tricking’ Gitaly to think its a repository.
- #to_gitaly_repository ⇒ Object
Constructor Details
#initialize(storage, relative_path, source_repository, gl_project_path) ⇒ ObjectPool
Returns a new instance of ObjectPool.
26 27 28 29 30 31 |
# File 'lib/gitlab/git/object_pool.rb', line 26 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_path ⇒ Object (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_path ⇒ Object (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_repository ⇒ Object (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 |
#storage ⇒ Object (readonly)
Returns the value of attribute storage.
13 14 15 |
# File 'lib/gitlab/git/object_pool.rb', line 13 def storage @storage end |
Class Method Details
.init_from_gitaly(gitaly_object_pool, source_repository) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gitlab/git/object_pool.rb', line 15 def self.init_from_gitaly(gitaly_object_pool, source_repository) repository = gitaly_object_pool.repository new( repository.storage_name, repository.relative_path, source_repository, repository.gl_project_path ) end |
Instance Method Details
#create ⇒ Object
33 34 35 |
# File 'lib/gitlab/git/object_pool.rb', line 33 def create object_pool_service.create(source_repository) end |
#fetch ⇒ Object
54 55 56 |
# File 'lib/gitlab/git/object_pool.rb', line 54 def fetch object_pool_service.fetch(source_repository) end |
#gitaly_object_pool ⇒ Object
41 42 43 |
# File 'lib/gitlab/git/object_pool.rb', line 41 def gitaly_object_pool Gitaly::ObjectPool.new(repository: to_gitaly_repository) end |
#link(to_link_repo) ⇒ Object
37 38 39 |
# File 'lib/gitlab/git/object_pool.rb', line 37 def link(to_link_repo) object_pool_service.link_repository(to_link_repo) end |
#repository ⇒ Object
Allows for reusing other RPCs by ‘tricking’ Gitaly to think its a repository
50 51 52 |
# File 'lib/gitlab/git/object_pool.rb', line 50 def repository @repository ||= Gitlab::Git::Repository.new(storage, relative_path, GL_REPOSITORY, gl_project_path) end |
#to_gitaly_repository ⇒ Object
45 46 47 |
# File 'lib/gitlab/git/object_pool.rb', line 45 def to_gitaly_repository Gitlab::GitalyClient::Util.repository(storage, relative_path, GL_REPOSITORY, gl_project_path) end |