Class: SimpleCov::ParallelAdapters::Base
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
|
Subclasses:
|
|
| Inherits: | Object |
| Defined in: | lib/simplecov/parallel_adapters/base.rb |
Overview
Default no-op implementations for a parallel-test-runner adapter. Real adapters subclass and override what they need; everything else falls back to "behave like a single-process run."
Adapters are classes (used as singletons, never instantiated) — they answer a small fixed set of questions about whether THIS worker process is the one that should do final-result work, and provide an optional hook for waiting on sibling workers.
Class Attribute Summary
-
.active? ⇒ Boolean
readonly
Should this adapter be selected for the current process? Adapters are tried in registration order; the first one whose .active? returns true is chosen.
-
.first_worker? ⇒ Boolean
readonly
Among the parallel workers in this run, should THIS worker do the final-result work (wait for siblings, merge resultsets, run threshold checks, format the report)? Default is
truefor the single-process case.
Class Method Summary
-
.expected_worker_count
How many parallel workers are participating in this run.
-
.wait_for_siblings
Optional: block until sibling workers have finished writing their resultsets.
Class Attribute Details
.active? ⇒ Boolean (readonly)
Should this adapter be selected for the current process? Adapters
are tried in registration order; the first one whose active?
returns true is chosen. Inactive adapters return false.
# File 'lib/simplecov/parallel_adapters/base.rb', line 20
def active? false end
.first_worker? ⇒ Boolean (readonly)
Among the parallel workers in this run, should THIS worker do
the final-result work (wait for siblings, merge resultsets,
run threshold checks, format the report)? Default is true
for the single-process case.
# File 'lib/simplecov/parallel_adapters/base.rb', line 28
def first_worker? true end
Class Method Details
.expected_worker_count
How many parallel workers are participating in this run. Used by the polling fallback to know how many resultset entries to expect. Defaults to 1 (single-process).
# File 'lib/simplecov/parallel_adapters/base.rb', line 45
def expected_worker_count 1 end
.wait_for_siblings
Optional: block until sibling workers have finished writing
their resultsets. An adapter that wraps a parallel-test runner
with a native synchronization primitive (e.g., parallel_tests's
wait_for_other_processes_to_finish) implements this for
lower latency; otherwise ::SimpleCov polls the resultset cache
as a fallback (see SimpleCov.wait_for_parallel_results).
# File 'lib/simplecov/parallel_adapters/base.rb', line 38
def wait_for_siblings # No-op default; polling fallback handles correctness. end