Module: SimpleCov::ParallelResultMerger::WorkerPayload

Extended by:
WorkerPayload
Included in:
WorkerPayload
Defined in:
lib/simplecov/parallel_result_merger/worker_payload.rb

Overview

What a worker ships back over its pipe: the [command_names, coverage] pair its slice folded to, the tracked paths the slice carried, and the slice's context-map union. Building and folding live together so the pipe format has one owner. The parent needs the union across every worker of the tracked paths, to know what nothing loaded, and of the maps, to judge the all-or-nothing rule over the whole run rather than per slice.

Instance Method Summary collapse

Instance Method Details

#absorb(payload, tracked_files, context_maps) ⇒ Object



22
23
24
25
26
# File 'lib/simplecov/parallel_result_merger/worker_payload.rb', line 22

def absorb(payload, tracked_files, context_maps)
  _pair, tracked, maps = payload
  tracked_files.merge(tracked)
  context_maps.absorb_union(maps)
end

#build(chunk, ignore_timeout:) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/simplecov/parallel_result_merger/worker_payload.rb', line 14

def build(chunk, ignore_timeout:)
  tracked_files = Set.new
  context_maps = ContextMap::Union.new
  pair = ResultMerger.absorb_results(chunk, ignore_timeout: ignore_timeout,
    &ResultMerger.entry_collector(tracked_files, context_maps))
  [pair, tracked_files.to_a, context_maps]
end

#pair(payload) ⇒ Object



28
29
30
# File 'lib/simplecov/parallel_result_merger/worker_payload.rb', line 28

def pair(payload)
  payload.first
end