Class: Gitlab::BackgroundMigration::MoveCiBuildsMetadata::JobsFilter
- Inherits:
-
Object
- Object
- Gitlab::BackgroundMigration::MoveCiBuildsMetadata::JobsFilter
- Defined in:
- lib/gitlab/background_migration/move_ci_builds_metadata.rb
Overview
The migration iterates over an entire p_ci_builds partition and with this class we’re applying the user defined cutoff policies so that only the relevant data is copied.
Instance Attribute Summary collapse
-
#jobs_batch ⇒ Object
readonly
Returns the value of attribute jobs_batch.
-
#migration ⇒ Object
readonly
Returns the value of attribute migration.
Instance Method Summary collapse
-
#initialize(migration, jobs_batch, config) ⇒ JobsFilter
constructor
A new instance of JobsFilter.
- #job_ids_filter ⇒ Object
- #jobs_for_definitions ⇒ Object
- #jobs_for_environments ⇒ Object
Constructor Details
#initialize(migration, jobs_batch, config) ⇒ JobsFilter
Returns a new instance of JobsFilter.
125 126 127 128 129 130 |
# File 'lib/gitlab/background_migration/move_ci_builds_metadata.rb', line 125 def initialize(migration, jobs_batch, config) @migration = migration @jobs_batch = jobs_batch @config = config @jobs_cache = {} end |
Instance Attribute Details
#jobs_batch ⇒ Object (readonly)
Returns the value of attribute jobs_batch.
123 124 125 |
# File 'lib/gitlab/background_migration/move_ci_builds_metadata.rb', line 123 def jobs_batch @jobs_batch end |
#migration ⇒ Object (readonly)
Returns the value of attribute migration.
123 124 125 |
# File 'lib/gitlab/background_migration/move_ci_builds_metadata.rb', line 123 def migration @migration end |
Instance Method Details
#job_ids_filter ⇒ Object
132 133 134 |
# File 'lib/gitlab/background_migration/move_ci_builds_metadata.rb', line 132 def job_ids_filter @job_ids_filter ||= load_jobs_created_after(migration_cutoff).pluck(:id, :partition_id) end |
#jobs_for_definitions ⇒ Object
136 137 138 |
# File 'lib/gitlab/background_migration/move_ci_builds_metadata.rb', line 136 def jobs_for_definitions @jobs_for_definitions ||= load_jobs_created_after(processing_data_cutoff) end |
#jobs_for_environments ⇒ Object
140 141 142 143 144 |
# File 'lib/gitlab/background_migration/move_ci_builds_metadata.rb', line 140 def jobs_for_environments return jobs_batch unless migration_cutoff.present? jobs_batch.where(created_at: migration_cutoff...) end |