Class: Gitlab::ImportExport::LfsSaver
- Inherits:
-
Object
- Object
- Gitlab::ImportExport::LfsSaver
- Includes:
- CommandLineUtil, DurationMeasuring
- Defined in:
- lib/gitlab/import_export/lfs_saver.rb
Constant Summary collapse
- BATCH_SIZE =
100
Constants included from CommandLineUtil
CommandLineUtil::CLEAN_DIR_IGNORE_FILE_NAMES, CommandLineUtil::CommandLineUtilError, CommandLineUtil::DEFAULT_DIR_MODE, CommandLineUtil::FileOversizedError, CommandLineUtil::HardLinkError, CommandLineUtil::UNTAR_MASK
Instance Attribute Summary collapse
-
#lfs_json ⇒ Object
Returns the value of attribute lfs_json.
-
#project ⇒ Object
Returns the value of attribute project.
-
#shared ⇒ Object
Returns the value of attribute shared.
Instance Method Summary collapse
-
#initialize(project:, shared:) ⇒ LfsSaver
constructor
A new instance of LfsSaver.
- #save ⇒ Object
Methods included from CommandLineUtil
#gunzip, #gzip, #gzip_with_options, #mkdir_p, #tar_cf, #tar_czf, #untar_xf, #untar_zxf
Constructor Details
#initialize(project:, shared:) ⇒ LfsSaver
Returns a new instance of LfsSaver.
13 14 15 16 17 |
# File 'lib/gitlab/import_export/lfs_saver.rb', line 13 def initialize(project:, shared:) @project = project @shared = shared @lfs_json = {} end |
Instance Attribute Details
#lfs_json ⇒ Object
Returns the value of attribute lfs_json.
9 10 11 |
# File 'lib/gitlab/import_export/lfs_saver.rb', line 9 def lfs_json @lfs_json end |
#project ⇒ Object
Returns the value of attribute project.
9 10 11 |
# File 'lib/gitlab/import_export/lfs_saver.rb', line 9 def project @project end |
#shared ⇒ Object
Returns the value of attribute shared.
9 10 11 |
# File 'lib/gitlab/import_export/lfs_saver.rb', line 9 def shared @shared end |
Instance Method Details
#save ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/gitlab/import_export/lfs_saver.rb', line 19 def save with_duration_measuring do project.lfs_objects.find_in_batches(batch_size: BATCH_SIZE) do |batch| batch.each do |lfs_object| save_lfs_object(lfs_object) end append_lfs_json_for_batch(batch) end write_lfs_json true end rescue StandardError => e shared.error(e) false end |