animedex.agg._fanout

Shared concurrent fan-out helper for aggregate commands.

Callers provide named source callables. The helper runs them independently, catches per-source failures, and returns a structured AggregateResult instead of raising on the first failed backend.

FanoutSource

class animedex.agg._fanout.FanoutSource(name: str, call: Callable[[], object])[source]

Bases: object

One source participating in aggregate fan-out.

Variables:
  • name (str) – Backend identifier.

  • call (callable) – Zero-argument callable that returns this source’s rows.

name: str
call: Callable[[], object]

run_fanout

animedex.agg._fanout.run_fanout(sources: Sequence[FanoutSource], *, max_workers: int | None = None) AggregateResult[source]

Run source calls and return one aggregate envelope.

Parameters:
  • sources (sequence of FanoutSource) – Source call descriptors to run.

  • max_workers (int or None) – Optional thread-pool size. None means one worker per source.

Returns:

Aggregate result with successful rows and per-source statuses.

Return type:

AggregateResult

selftest

animedex.agg._fanout.selftest() bool[source]

Smoke-test success, empty, and failed fan-out paths.

Returns:

True on success.

Return type:

bool