Sha256: 4600df8f066a9b6893a73444993514fc3a13d58080cdb97e96d3d00bd3023d90

Contents?: true

Size: 784 Bytes

Versions: 3

Compression:

Stored size: 784 Bytes

Contents

require 'fileutils'

module Uricp::Strategy
  class PipedCache
    include Uricp::Strategy::Common
    include Uricp::Strategy::CacheCommon

    def appropriate?
      with_active_cache do
        case from.scheme
        when 'pipe'
          validate_cache!
          return proposal
        end
        debug "#{self.class.name}: not appropriate"
        false
      end
    end

    def command
      "tee #{temp_cache_file} |"
    end

    def proposal
      @proposed_options = options.dup
      @proposed_options['sweep'] = [temp_cache_file, cache_file]
      if to.scheme == 'rbd'
        @proposed_options['rbd_cache_name'] = rbd_cache_image_spec(to)
      end
      @proposed_options.delete('cache')
      @proposed_options.delete('cache_name')
      self
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uricp-0.0.22 lib/uricp/strategy/piped_cache.rb
uricp-0.0.21 lib/uricp/strategy/piped_cache.rb
uricp-0.0.20 lib/uricp/strategy/piped_cache.rb