Class: BulkImports::RelationBatchExportService

Inherits:
Object
  • Object
show all
Includes:
Gitlab::ImportExport::CommandLineUtil
Defined in:
app/services/bulk_imports/relation_batch_export_service.rb

Constant Summary

Constants included from Gitlab::ImportExport::CommandLineUtil

Gitlab::ImportExport::CommandLineUtil::CLEAN_DIR_IGNORE_FILE_NAMES, Gitlab::ImportExport::CommandLineUtil::CommandLineUtilError, Gitlab::ImportExport::CommandLineUtil::DEFAULT_DIR_MODE, Gitlab::ImportExport::CommandLineUtil::FileOversizedError, Gitlab::ImportExport::CommandLineUtil::HardLinkError, Gitlab::ImportExport::CommandLineUtil::UNTAR_MASK

Instance Method Summary collapse

Methods included from Gitlab::ImportExport::CommandLineUtil

#gunzip, #gzip, #gzip_with_options, #mkdir_p, #tar_cf, #tar_czf, #untar_xf, #untar_zxf

Constructor Details

#initialize(user_id, batch_id) ⇒ RelationBatchExportService

Returns a new instance of RelationBatchExportService.



7
8
9
10
11
# File 'app/services/bulk_imports/relation_batch_export_service.rb', line 7

def initialize(user_id, batch_id)
  @user = User.find(user_id)
  @batch = BulkImports::ExportBatch.find(batch_id)
  @config = FileTransfer.config_for(portable)
end

Instance Method Details

#executeObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/services/bulk_imports/relation_batch_export_service.rb', line 13

def execute
  start_batch!

  export_service.export_batch(relation_batch_ids)
  compress_exported_relation
  upload_compressed_file

  finish_batch!
rescue StandardError => e
  fail_batch!(e)
ensure
  FileUtils.remove_entry(export_path)
end