Class: Gitlab::GithubImport::Importer::ProtectedBranchesImporter
- Inherits:
-
Object
- Object
- Gitlab::GithubImport::Importer::ProtectedBranchesImporter
show all
- Includes:
- ParallelScheduling
- Defined in:
- lib/gitlab/github_import/importer/protected_branches_importer.rb
Constant Summary
ParallelScheduling::ALREADY_IMPORTED_CACHE_KEY, ParallelScheduling::JOB_WAITER_CACHE_KEY, ParallelScheduling::JOB_WAITER_REMAINING_CACHE_KEY
Instance Attribute Summary
#already_imported_cache_key, #client, #job_waiter_cache_key, #job_waiter_remaining_cache_key, #page_counter, #project
Instance Method Summary
collapse
#abort_on_failure, #already_imported?, #collection_options, #execute, #increment_object_counter?, #initialize, #mark_as_imported, #parallel?, #parallel_import, #sequential_import, #spread_parallel_import
#parallel_import_batch
Instance Method Details
#collection_method ⇒ Object
44
45
46
|
# File 'lib/gitlab/github_import/importer/protected_branches_importer.rb', line 44
def collection_method
:protected_branches
end
|
#each_object_to_import ⇒ Object
The method that will be called for traversing through all the objects to import, yielding them to the supplied block.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/gitlab/github_import/importer/protected_branches_importer.rb', line 11
def each_object_to_import
repo = project.import_source
protected_branches = client.branches(repo).select { |branch| branch.dig(:protection, :enabled) }
protected_branches.each do |protected_branch|
next if already_imported?(protected_branch)
object = client.branch_protection(repo, protected_branch[:name])
next if object.nil?
yield object
Gitlab::GithubImport::ObjectCounter.increment(project, object_type, :fetched)
mark_as_imported(protected_branch)
end
end
|
#id_for_already_imported_cache(protected_branch) ⇒ Object
48
49
50
|
# File 'lib/gitlab/github_import/importer/protected_branches_importer.rb', line 48
def id_for_already_imported_cache(protected_branch)
protected_branch[:name]
end
|
#importer_class ⇒ Object
28
29
30
|
# File 'lib/gitlab/github_import/importer/protected_branches_importer.rb', line 28
def importer_class
ProtectedBranchImporter
end
|
#object_type ⇒ Object
40
41
42
|
# File 'lib/gitlab/github_import/importer/protected_branches_importer.rb', line 40
def object_type
:protected_branch
end
|
#representation_class ⇒ Object
#sidekiq_worker_class ⇒ Object
36
37
38
|
# File 'lib/gitlab/github_import/importer/protected_branches_importer.rb', line 36
def sidekiq_worker_class
ImportProtectedBranchWorker
end
|