Class: Uricp::Strategy::SegmentedRemotePut

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

Constant Summary

Constants included from Common

Common::PIPE_URI

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?, #encoding, #file_source?, #format_change?, #get_temp_filename, #initialize, #lz4?, #lz4_source?, #proposed_path, #qcow2?, #raw_target?, #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

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/uricp/strategy/segmented_remote_put.rb', line 7

def appropriate?
  if segmented?
    if compression_required? || conversion_required?
	  debug "#{self.class.name}: not ready to upload"
	else
	  case to.scheme
	  when 'http', 'https'
 case from.scheme
 when 'file', 'pipe'
   if http_authentication?
		return proposal
   else
		unsupported_transfer
   end
 end
	  end
	  debug "#{self.class.name}: not appropriate"
	end
  else
    debug "#{self.class.name}: no segmentation requested"
  end
  false
end

#commandObject



31
32
33
# File 'lib/uricp/strategy/segmented_remote_put.rb', line 31

def command
  "segment_upload --segment-size '#{options['segment-size']}' #{source_details} #{to.to_s};"
end

#proposalObject



35
36
37
38
39
40
# File 'lib/uricp/strategy/segmented_remote_put.rb', line 35

def proposal
  @proposed_options = options.dup
  @proposed_options['from_uri'] = to
  @proposed_options['segment-size'] = nil
  self
end

#segmented?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/uricp/strategy/segmented_remote_put.rb', line 46

def segmented?
  options['segment-size']
end

#source_detailsObject



42
43
44
# File 'lib/uricp/strategy/segmented_remote_put.rb', line 42

def source_details
  "--from #{from.path}" unless from.scheme == 'pipe'
end