Sha256: 0a2cca6e61254b7d03b3d04588fa9a5a550521985a36651f418b487c89fb6ae4
Contents?: true
Size: 1.58 KB
Versions: 3
Compression:
Stored size: 1.58 KB
Contents
require 'uri' module Uricp class UriStrategy include Methadone::CLILogging def self.choose_strategy(options) current = options.reject { |k, _v| k.is_a? Symbol } strategy_list = [] while STRATEGIES.detect { |klass| @strategy = klass.new(current).appropriate? } debug "#{name}: Selected strategy #{@strategy.class.name}" strategy_list << @strategy current = @strategy.proposed_options end if incomplete_strategy?(strategy_list) raise Uricp::UnsupportedURLtype, "Unsupported transfer from #{options['from_uri']} to #{options['to_uri']}" end strategy_list end def self.incomplete_strategy?(list) list.empty? end # This is an ordered list from the most specific to the most general STRATEGIES = [ Strategy::RbdCachedGet, Strategy::RbdCacheClone, Strategy::RbdCacheCheck, Strategy::RbdSnap, Strategy::CachedGet, Strategy::PipedRemoteGet, Strategy::PipedRbdGet, Strategy::PipedCacheConvert, Strategy::PipedCache, Strategy::PipedLocalDecompress, Strategy::PipedDecompress, Strategy::LocalConvert, Strategy::LocalLink, Strategy::PipedCompress, Strategy::RbdCacheUpload, Strategy::RbdCachedPut, Strategy::RbdPut, Strategy::RbdCacheBaseSnap, Strategy::SegmentedRemotePut, Strategy::RemotePut, Strategy::PipedLocalCompress, Strategy::PipedLocalGet, Strategy::PipedLocalPut, Strategy::Cleaner, Strategy::RbdSweeper, Strategy::Sweeper ].freeze end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
uricp-0.0.24 | lib/uricp/uri_strategy.rb |
uricp-0.0.23 | lib/uricp/uri_strategy.rb |
uricp-0.0.22 | lib/uricp/uri_strategy.rb |