Class: Uricp::Strategy::PipedLocalCompress

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/uricp/strategy/piped_local_compress.rb

Constant Summary

Constants included from Common

Common::DRY_SNAP, Common::PIPE_URI, Common::VOL_REGEX

Constants included from CurlPrimitives

CurlPrimitives::ORBIT_HOSTS

Instance Attribute Summary

Attributes included from Common

#proposed_options

Attributes included from CurlPrimitives

#options

Instance Method Summary collapse

Methods included from Common

#all_local_files?, #always_write_sparse?, #compression_required?, #conversion_required?, #dry_run?, #encoding, #file_source?, #format_change?, #get_temp_filename, #in_rbd_cache, #in_rbd_cache?, #initialize, #lz4?, #lz4_source?, #not_in_rbd_cache?, #proposed_path, #qcow2?, #raw_target?, #rbd_base_name, #rbd_cache_image_exists?, #rbd_cache_image_spec, #rbd_cache_name, #rbd_cache_upload_available?, #rbd_clone_snapshot, #rbd_id, #rbd_image_spec, #rbd_sequence_complete?, #rbd_snapshot_name, #rbd_snapshot_spec?, #rbd_uri, #segmented?, #sequence_complete?, #snap_check, #supported_source?, #temp_uri, #unsupported_transfer, #xz?, #xz_source?

Methods included from CurlPrimitives

#authentication, #curl_command, #curl_download_to_pipe, #curl_manifest, #curl_upload_from, #from, #from=, #http_authentication?, #orbit?, #temp_url?, #to, #to=

Instance Method Details

#appropriate?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
# File 'lib/uricp/strategy/piped_local_compress.rb', line 7

def appropriate?
  case from.scheme
  when 'file'
    return proposal if !sequence_complete? && compression_required?
  end
  debug "#{self.class.name}: not appropriate"
  false
end

#commandObject



16
17
18
# File 'lib/uricp/strategy/piped_local_compress.rb', line 16

def command
  "lz4 -c <'#{from.path}' |"
end

#proposalObject



20
21
22
23
24
25
26
# File 'lib/uricp/strategy/piped_local_compress.rb', line 20

def proposal
  @proposed_options = options.dup
  @proposed_options.delete('compress')
  @proposed_options['encoding'] = 'lz4'
  @proposed_options['from_uri'] = PIPE_URI
  self
end