Sha256: c539ba01d7ad28a558b091a9ee543b2b3013a94fde48321b47cf8280a4cf8ccd

Contents?: true

Size: 986 Bytes

Versions: 12

Compression:

Stored size: 986 Bytes

Contents

# frozen_string_literal: true

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

12 entries across 12 versions & 1 rubygems

Version Path
uricp-0.0.37 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.36 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.35 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.34 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.32 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.31 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.30 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.29 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.28 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.27 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.26 lib/uricp/strategy/segmented_remote_put.rb
uricp-0.0.25 lib/uricp/strategy/segmented_remote_put.rb