Class: Uricp::Strategy::PipedCacheConvert
- Inherits:
-
Object
- Object
- Uricp::Strategy::PipedCacheConvert
- Includes:
- CacheCommon, Common
- Defined in:
- lib/uricp/strategy/piped_cache_convert.rb
Constant Summary
Constants included from Common
Common::DRY_SNAP, Common::PIPE_URI
Instance Attribute Summary
Attributes included from Common
Attributes included from CurlPrimitives
Instance Method Summary collapse
Methods included from CacheCommon
#cache_exists?, #cache_file, #cache_name, #cache_root, #in_cache?, #temp_cache_file, #temp_cache_uri, #validate_cache!, #with_active_cache, #without_active_cache
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?, #supported_source?, #temp_uri, #unsupported_transfer
Methods included from CurlPrimitives
#authentication, #curl_command, #curl_download_to_pipe, #curl_manifest, #curl_upload_from, #from, #from=, #http_authentication?, #to, #to=
Instance Method Details
#appropriate? ⇒ Boolean
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/uricp/strategy/piped_cache_convert.rb', line 8 def appropriate? if conversion_required? && supported_source? case from.scheme when 'pipe' validate_cache! if cache_root return proposal end debug "#{self.class.name}: not appropriate" else debug "#{self.class.name}: no non-stream conversion detected" end false end |
#command ⇒ Object
22 23 24 |
# File 'lib/uricp/strategy/piped_cache_convert.rb', line 22 def command "cp --sparse=always /dev/stdin #{proposed_path};" end |
#proposal ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/uricp/strategy/piped_cache_convert.rb', line 26 def proposal @proposed_options = .dup if cache_root @proposed_options['from_uri'] = temp_cache_uri @proposed_options['sweep'] = [temp_cache_file, cache_file] @proposed_options.delete('cache') @proposed_options.delete('cache_name') else @proposed_options['from_uri'] = temp_uri @proposed_options['clean'] ||= [] @proposed_options['clean'] << proposed_path end self end |