Class: Uricp::Strategy::PipedLocalDecompress
- Inherits:
-
Object
- Object
- Uricp::Strategy::PipedLocalDecompress
show all
- Includes:
- Common
- Defined in:
- lib/uricp/strategy/piped_local_decompress.rb
Constant Summary
Constants included
from Common
Common::PIPE_URI
Instance Attribute Summary
Attributes included from Common
#proposed_options
#options
Instance Method Summary
collapse
Methods included from Common
#all_local_files?, #always_write_sparse?, #compression_required?, #conversion_required?, #encoding, #file_source?, #format_change?, #get_temp_filename, #initialize, #lz4?, #lz4_source?, #proposed_path, #qcow2?, #raw_target?, #segmented?, #sequence_complete?, #supported_source?, #temp_uri, #unsupported_transfer
#authentication, #curl_command, #curl_download_to_pipe, #curl_manifest, #curl_upload_from, #from, #from=, #http_authentication?, #to, #to=
Instance Method Details
#appropriate? ⇒ Boolean
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/uricp/strategy/piped_local_decompress.rb', line 7
def appropriate?
case from.scheme
when 'pipe'
if raw_target? && lz4_source? && to.scheme == 'file'
if always_write_sparse?
return proposal
else
debug "#{self.class.name}: using safe sparse expansion via stream"
end
end
end
debug "#{self.class.name}: not appropriate"
false
end
|
#command ⇒ Object
22
23
24
|
# File 'lib/uricp/strategy/piped_local_decompress.rb', line 22
def command
"lz4 -qdf - #{to.path};"
end
|
#proposal ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/uricp/strategy/piped_local_decompress.rb', line 26
def proposal
@proposed_options = options.dup
@proposed_options.delete('source-format')
if @proposed_options['target-format']
@proposed_options['source-format'] = :raw
if @proposed_options['source-format'] == @proposed_options['target-format']
@proposed_options.delete('source-format')
@proposed_options.delete('target-format')
end
end
@proposed_options['from_uri'] = @proposed_options['to_uri']
self
end
|