Class: Gitlab::BackgroundMigration::MoveCiBuildsMetadata::JobsPreloader
- Inherits:
-
Object
- Object
- Gitlab::BackgroundMigration::MoveCiBuildsMetadata::JobsPreloader
- Defined in:
- lib/gitlab/background_migration/move_ci_builds_metadata.rb
Overview
Not all data resides in the builds_metadata table, so we need to query other tables too. Since we can’t use application code here, we’re building a similar abstraction to the ActiveRecord preloader to load connected data. It returns a new jobs collection with tags, execution steps, and the metadata record.
Instance Attribute Summary collapse
-
#jobs ⇒ Object
readonly
Returns the value of attribute jobs.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(migration, jobs) ⇒ JobsPreloader
constructor
A new instance of JobsPreloader.
Constructor Details
#initialize(migration, jobs) ⇒ JobsPreloader
Returns a new instance of JobsPreloader.
190 191 192 193 |
# File 'lib/gitlab/background_migration/move_ci_builds_metadata.rb', line 190 def initialize(migration, jobs) @migration = migration @jobs = jobs end |
Instance Attribute Details
#jobs ⇒ Object (readonly)
Returns the value of attribute jobs.
188 189 190 |
# File 'lib/gitlab/background_migration/move_ci_builds_metadata.rb', line 188 def jobs @jobs end |
Instance Method Details
#execute ⇒ Object
195 196 197 198 199 200 201 202 203 204 |
# File 'lib/gitlab/background_migration/move_ci_builds_metadata.rb', line 195 def execute jobs.map do |job| JobPresenter.new( job, metadata: [job.id], tag_list: tag_records[job.id], run_steps: run_steps_records[job.id] ) end end |