Sha256: 68534f039d356b71e3c94e26751f83621e87390c647a3d736ff2fc8b588f57ea

Contents?: true

Size: 907 Bytes

Versions: 1

Compression:

Stored size: 907 Bytes

Contents

require 'fileutils'

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

    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' && !rbd_cache_image_exists?(image_spec_to_check)
        @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.23 lib/uricp/strategy/piped_cache.rb