Class: Uricp::Strategy::LocalLink
- Inherits:
-
Object
- Object
- Uricp::Strategy::LocalLink
show all
- Includes:
- Common
- Defined in:
- lib/uricp/strategy/local_link.rb
Constant Summary
Constants included
from Common
Common::DRY_SNAP, 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?, #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
#authentication, #curl_command, #curl_download_to_pipe, #curl_manifest, #curl_upload_from, #from, #from=, #http_authentication?, #to, #to=
Instance Method Details
#appropriate? ⇒ Boolean
5
6
7
8
9
10
11
12
13
|
# File 'lib/uricp/strategy/local_link.rb', line 5
def appropriate?
return proposal if !compression_required? &&
all_local_files? &&
!format_change? &&
linkable?
debug "#{self.class.name}: not appropriate"
false
end
|
#command ⇒ Object
15
16
17
|
# File 'lib/uricp/strategy/local_link.rb', line 15
def command
"ln -fT #{from.path} #{to.path};"
end
|
#linkable? ⇒ Boolean
25
26
27
28
29
30
31
|
# File 'lib/uricp/strategy/local_link.rb', line 25
def linkable?
from_path_dir = File.dirname(from.path)
to_path_dir = File.dirname(to.path)
File.directory?(from_path_dir) && File.directory?(to_path_dir) &&
File.stat(from_path_dir).dev == File.stat(to_path_dir).dev &&
(!File.exist?(to.path) || File.file?(to.path))
end
|
#proposal ⇒ Object
19
20
21
22
23
|
# File 'lib/uricp/strategy/local_link.rb', line 19
def proposal
@proposed_options = options.dup
@proposed_options['from_uri'] = @proposed_options['to_uri']
self
end
|