Class: Evilution::Runner::MutationExecutor::ResultCache Private
- Inherits:
-
Object
- Object
- Evilution::Runner::MutationExecutor::ResultCache
- Defined in:
- lib/evilution/runner/mutation_executor/result_cache.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: Partition
Instance Method Summary collapse
- #fetch(mutation) ⇒ Object private
-
#initialize(backend) ⇒ ResultCache
constructor
private
A new instance of ResultCache.
- #partition(batch, packer:) ⇒ Object private
- #store(mutation, result) ⇒ Object private
Constructor Details
#initialize(backend) ⇒ ResultCache
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ResultCache.
12 13 14 |
# File 'lib/evilution/runner/mutation_executor/result_cache.rb', line 12 def initialize(backend) @backend = backend end |
Instance Method Details
#fetch(mutation) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/evilution/runner/mutation_executor/result_cache.rb', line 16 def fetch(mutation) return nil unless @backend data = @backend.fetch(mutation) return nil unless data return nil unless CACHEABLE_STATUSES.include?(data[:status]) Evilution::Result::MutationResult.new( mutation: mutation, status: data[:status], duration: data[:duration], killing_test: data[:killing_test], test_command: data[:test_command] ) end |
#partition(batch, packer:) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/evilution/runner/mutation_executor/result_cache.rb', line 43 def partition(batch, packer:) uncached_indices = [] cached_results = {} batch.each_with_index do |mutation, i| if mutation.unparseable? cached_results[i] = packer.compact(unparseable_result(mutation)) next end cached = fetch(mutation) if cached cached_results[i] = packer.compact(cached) else uncached_indices << i end end Partition.new(uncached_indices: uncached_indices, cached_results: cached_results) end |
#store(mutation, result) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/evilution/runner/mutation_executor/result_cache.rb', line 32 def store(mutation, result) return unless @backend return unless result.killed? || result.timeout? @backend.store(mutation, status: result.status, duration: result.duration, killing_test: result.killing_test, test_command: result.test_command) end |