Class: Backarch::TarWrapper
- Inherits:
-
Object
- Object
- Backarch::TarWrapper
- Defined in:
- lib/backarch/tar_wrapper.rb
Constant Summary collapse
- BLOCKSIZE =
BLOCKSIZE = 10737418 # 10MB
1_073_741_824
Class Method Summary collapse
-
.create_multiple_volumes(origin, destination) ⇒ Object
Invokes GNU tar to generate a multi-volume tar for parallel upload and download.
- .restore_from_volumes(origin, destination) ⇒ Object
Class Method Details
.create_multiple_volumes(origin, destination) ⇒ Object
Invokes GNU tar to generate a multi-volume tar for parallel upload and download. eg: gtar -cML 30720 -f file1.tar -f file2.tar -C /tmp/elasticsearch_snapshots/full 20140605
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/backarch/tar_wrapper.rb', line 11 def create_multiple_volumes(origin, destination) FileUtils.mkdir_p destination tar = validate_gnu_tar_installed output_files = generate_output_files(origin, destination) tape_limit = BLOCKSIZE / 1024 working_directory = File.dirname origin basename = File.basename origin command = "#{tar} -cML #{tape_limit} -f #{output_files.join(" -f ")} -C #{working_directory} #{basename}" LOG.info "Creating tar volumes: #{command}" return StandardError, "Failed to create tar volumes" unless system(command) end |
.restore_from_volumes(origin, destination) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/backarch/tar_wrapper.rb', line 25 def restore_from_volumes(origin, destination) FileUtils.mkdir_p destination tar = validate_gnu_tar_installed input_files = generate_input_files(origin) command = "#{tar} -xMf #{input_files.join(" -f ")} -C #{destination}" LOG.info "Restoring from tar volumes: #{command}" return StandardError, "Failed to restore from tar volumes" unless system(command) end |