Class: PoolRepository
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- PoolRepository
- Includes:
- AfterCommitQueue, Shardable
- Defined in:
- app/models/pool_repository.rb
Overview
The PoolRepository model is the database equivalent of an ObjectPool for Gitaly That is; PoolRepository is the record in the database, ObjectPool is the repository on disk
Constant Summary
Constants inherited from ApplicationRecord
Constants included from ResetOnUnionError
ResetOnUnionError::MAX_RESET_PERIOD
Instance Method Summary collapse
- #create_object_pool ⇒ Object
-
#delete_object_pool ⇒ Object
The members of the pool should have fetched the missing objects to their own objects directory.
- #inspect ⇒ Object
- #link_repository(repository) ⇒ Object
- #object_pool ⇒ Object
- #unlink_repository(repository, disconnect: true) ⇒ Object
Methods included from AfterCommitQueue
#run_after_commit, #run_after_commit_or_now
Methods included from Shardable
Methods inherited from ApplicationRecord
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from SensitiveSerializableHash
Instance Method Details
#create_object_pool ⇒ Object
76 77 78 |
# File 'app/models/pool_repository.rb', line 76 def create_object_pool object_pool.create end |
#delete_object_pool ⇒ Object
The members of the pool should have fetched the missing objects to their own objects directory. If the caller fails to do so, data loss might occur
82 83 84 |
# File 'app/models/pool_repository.rb', line 82 def delete_object_pool object_pool.delete end |
#inspect ⇒ Object
109 110 111 112 |
# File 'app/models/pool_repository.rb', line 109 def inspect source = source_project ? source_project.full_path : 'nil' "#<#{self.class.name} id:#{id} state:#{state} disk_path:#{disk_path} source_project: #{source}>" end |
#link_repository(repository) ⇒ Object
86 87 88 |
# File 'app/models/pool_repository.rb', line 86 def link_repository(repository) object_pool.link(repository.raw) end |
#object_pool ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'app/models/pool_repository.rb', line 100 def object_pool @object_pool ||= Gitlab::Git::ObjectPool.new( shard.name, disk_path + '.git', source_project&.repository&.raw, source_project&.full_path ) end |
#unlink_repository(repository, disconnect: true) ⇒ Object
90 91 92 93 94 95 96 97 98 |
# File 'app/models/pool_repository.rb', line 90 def unlink_repository(repository, disconnect: true) repository.disconnect_alternates if disconnect if member_projects.where.not(id: repository.project.id).exists? true else mark_obsolete end end |