summaryrefslogtreecommitdiff
path: root/lib/bulk_imports/pipeline.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bulk_imports/pipeline.rb')
-rw-r--r--lib/bulk_imports/pipeline.rb33
1 files changed, 32 insertions, 1 deletions
diff --git a/lib/bulk_imports/pipeline.rb b/lib/bulk_imports/pipeline.rb
index df4f020d6b2..f27818dae18 100644
--- a/lib/bulk_imports/pipeline.rb
+++ b/lib/bulk_imports/pipeline.rb
@@ -8,8 +8,11 @@ module BulkImports
include Runner
NotAllowedError = Class.new(StandardError)
+ ExpiredError = Class.new(StandardError)
+ FailedError = Class.new(StandardError)
CACHE_KEY_EXPIRATION = 2.hours
+ NDJSON_EXPORT_TIMEOUT = 30.minutes
def initialize(context)
@context = context
@@ -19,6 +22,18 @@ module BulkImports
@tracker ||= context.tracker
end
+ def portable
+ @portable ||= context.portable
+ end
+
+ def import_export_config
+ @import_export_config ||= context.import_export_config
+ end
+
+ def current_user
+ @current_user ||= context.current_user
+ end
+
included do
private
@@ -111,7 +126,7 @@ module BulkImports
options = class_config[:options]
if options
- class_config[:klass].new(class_config[:options])
+ class_config[:klass].new(**class_config[:options])
else
class_config[:klass].new
end
@@ -155,6 +170,22 @@ module BulkImports
class_attributes[:abort_on_failure]
end
+ def ndjson_pipeline!
+ class_attributes[:ndjson_pipeline] = true
+ end
+
+ def ndjson_pipeline?
+ class_attributes[:ndjson_pipeline]
+ end
+
+ def relation_name(name)
+ class_attributes[:relation_name] = name
+ end
+
+ def relation
+ class_attributes[:relation_name]
+ end
+
private
def add_attribute(sym, klass, options)