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 HasCheckConstraints
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
Constants included from ResetOnColumnErrors
ResetOnColumnErrors::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, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, 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 Organizations::Sharding
Methods included from ResetOnColumnErrors
#reset_on_union_error, #reset_on_unknown_attribute_error
Methods included from Gitlab::SensitiveSerializableHash
Instance Method Details
#create_object_pool ⇒ Object
86 87 88 89 90 |
# File 'app/models/pool_repository.rb', line 86 def create_object_pool object_pool.create rescue GRPC::AlreadyExists # The object pool already exists. Nothing to do here. 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
94 95 96 |
# File 'app/models/pool_repository.rb', line 94 def delete_object_pool object_pool.delete end |
#inspect ⇒ Object
117 118 119 120 |
# File 'app/models/pool_repository.rb', line 117 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
98 99 100 |
# File 'app/models/pool_repository.rb', line 98 def link_repository(repository) object_pool.link(repository.raw) end |
#object_pool ⇒ Object
108 109 110 111 112 113 114 115 |
# File 'app/models/pool_repository.rb', line 108 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
102 103 104 105 106 |
# File 'app/models/pool_repository.rb', line 102 def unlink_repository(repository, disconnect: true) repository.disconnect_alternates if disconnect member_projects.id_not_in(repository.project.id).exists? || mark_obsolete end |