Class: BulkImports::LfsObjectsExportService

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

Constant Summary collapse

BATCH_SIZE =
100

Constants included from Gitlab::ImportExport::CommandLineUtil

Gitlab::ImportExport::CommandLineUtil::DEFAULT_DIR_MODE, Gitlab::ImportExport::CommandLineUtil::FileOversizedError, 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(portable, export_path) ⇒ LfsObjectsExportService

Returns a new instance of LfsObjectsExportService.


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

def initialize(portable, export_path)
  @portable = portable
  @export_path = export_path
  @lfs_json = {}
end

Instance Method Details

#executeObject


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

def execute
  portable.lfs_objects.find_in_batches(batch_size: BATCH_SIZE) do |batch| # rubocop: disable CodeReuse/ActiveRecord
    batch.each do |lfs_object|
      save_lfs_object(lfs_object)
    end

    append_lfs_json_for_batch(batch)
  end

  write_lfs_json
end