Class: BulkImports::RelationExportService

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

Constant Summary collapse

EXISTING_EXPORT_TTL =
3.minutes

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, portable, relation, jid) ⇒ RelationExportService

Returns a new instance of RelationExportService.



9
10
11
12
13
14
15
# File 'app/services/bulk_imports/relation_export_service.rb', line 9

def initialize(user, portable, relation, jid)
  @user = user
  @portable = portable
  @relation = relation
  @jid = jid
  @config = FileTransfer.config_for(portable)
end

Instance Method Details

#executeObject



17
18
19
20
21
22
23
24
25
26
# File 'app/services/bulk_imports/relation_export_service.rb', line 17

def execute
  find_or_create_export! do |export|
    export.remove_existing_upload!
    export_service.execute
    compress_exported_relation
    upload_compressed_file(export)
  end
ensure
  FileUtils.remove_entry(export_path)
end