Sha256: e8b9fc15aa61a2aec5103ff9a5648ca9cab165c47248dfca3abe24f70964f068

Contents?: true

Size: 832 Bytes

Versions: 1

Compression:

Stored size: 832 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]
      image_spec_to_check = rbd_cache_image_spec(to)
      if to.scheme == 'rbd'
        @proposed_options['rbd_cache_name'] = image_spec_to_check
      end
      @proposed_options.delete('cache')
      @proposed_options.delete('cache_name')
      self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
uricp-0.0.24 lib/uricp/strategy/piped_cache.rb