The seam where checkpoints are recorded.
Production never resolves a test owner: it only asks the configured backend
whether the calling process is recording and, if it is, hands the checkpoint
over. The default backend, DdDataStreams.Backend.Aggregator, reads
DdDataStreams.Config.enabled?/0 and calls
DdDataStreams.Aggregator.add/1, so an application that configures nothing
behaves exactly as it did before this behaviour existed.
A test suite can replace it with DdDataStreams.Testing.Backend:
config :dd_data_streams, backend: DdDataStreams.Testing.BackendThat backend answers per process, from NimbleOwnership, instead of from the
application environment, so tests that opt in can run concurrently without
seeing each other's checkpoints. An application that configures no backend
never references the testing modules.
Summary
Functions
Asks the configured backend whether the calling process is recording.
The configured backend, or the default one when :backend is not set.
Hands one checkpoint to the configured backend.
Callbacks
@callback enabled?() :: boolean()
Whether the calling process is recording checkpoints.
@callback record(DdDataStreams.Pathway.checkpoint()) :: :ok
Records one checkpoint.
Called only when enabled?/0 answered true for the same process.
Functions
@spec enabled?() :: boolean()
Asks the configured backend whether the calling process is recording.
@spec impl() :: module()
The configured backend, or the default one when :backend is not set.
@spec record(DdDataStreams.Pathway.checkpoint()) :: :ok
Hands one checkpoint to the configured backend.