Sha256: 126e77f01541a300907294580c07a3eff1eb2ebc302bda8fd29973551f1df7c4

Contents?: true

Size: 955 Bytes

Versions: 8

Compression:

Stored size: 955 Bytes

Contents

module Uricp::Strategy
  class SegmentedRemotePut
    include Uricp::Strategy::Common

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

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

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
uricp-0.0.24 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.23 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.22 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.21 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.20 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.18 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.17 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.16 lib/uricp/strategy/segmented_remote_put.rb