Sha256: 59a050ec4a7ac1ab329a6a6d4ed74b7cbf6eb0af154833f90d07b9b8098d124c

Contents?: true

Size: 863 Bytes

Versions: 12

Compression:

Stored size: 863 Bytes

Contents

# frozen_string_literal: true

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

12 entries across 12 versions & 1 rubygems

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