Module: Gitlab::GithubImport::ObjectImporter
- Extended by:
- ActiveSupport::Concern
- Included in:
- ImportDiffNoteWorker, ImportIssueWorker, ImportLfsObjectWorker, ImportNoteWorker, ImportPullRequestWorker
- Defined in:
- app/workers/concerns/gitlab/github_import/object_importer.rb
Overview
ObjectImporter defines the base behaviour for every Sidekiq worker that imports a single resource such as a note or pull request.
Instance Method Summary collapse
- #counter ⇒ Object
-
#counter_description ⇒ Object
Returns the description (as a String) of the Prometheus counter.
-
#counter_name ⇒ Object
Returns the name (as a Symbol) of the Prometheus counter.
-
#import(project, client, hash) ⇒ Object
project - An instance of `Project` to import the data into.
-
#importer_class ⇒ Object
Returns the class to use for importing the object.
-
#representation_class ⇒ Object
Returns the representation class to use for the object.
Instance Method Details
#counter ⇒ Object
31 32 33 |
# File 'app/workers/concerns/gitlab/github_import/object_importer.rb', line 31 def counter @counter ||= Gitlab::Metrics.counter(counter_name, counter_description) end |
#counter_description ⇒ Object
Returns the description (as a String) of the Prometheus counter.
52 53 54 |
# File 'app/workers/concerns/gitlab/github_import/object_importer.rb', line 52 def counter_description raise NotImplementedError end |
#counter_name ⇒ Object
Returns the name (as a Symbol) of the Prometheus counter.
47 48 49 |
# File 'app/workers/concerns/gitlab/github_import/object_importer.rb', line 47 def counter_name raise NotImplementedError end |
#import(project, client, hash) ⇒ Object
project - An instance of `Project` to import the data into. client - An instance of `Gitlab::GithubImport::Client` hash - A Hash containing the details of the object to import.
23 24 25 26 27 28 29 |
# File 'app/workers/concerns/gitlab/github_import/object_importer.rb', line 23 def import(project, client, hash) object = representation_class.from_json_hash(hash) importer_class.new(object, project, client).execute counter.increment end |
#importer_class ⇒ Object
Returns the class to use for importing the object.
42 43 44 |
# File 'app/workers/concerns/gitlab/github_import/object_importer.rb', line 42 def importer_class raise NotImplementedError end |
#representation_class ⇒ Object
Returns the representation class to use for the object. This class must define the class method `from_json_hash`.
37 38 39 |
# File 'app/workers/concerns/gitlab/github_import/object_importer.rb', line 37 def representation_class raise NotImplementedError end |