auradefi 0.1.1
PyPI GitHub

SyncReport

auradefi.embed.models · source

Aggregate result of one sync() tick (SPEC §8).

Same invariants as ConnectionSyncReport: negative counts raise auradefi.errors.ValidationError, as does no_op=True with any non-zero count and any split where pages_fetched != live_pages + backfill_pages. The tick's whole budget is the sum of the two phases it was spent on.

connections carries the per-connection breakdown, defaulting to (). When it is non-empty it PINS the aggregate: each of the four counts must equal the sum over the rows and no_op must be True exactly when every row is a no-op. An aggregate that contradicts its own breakdown raises ValidationError rather than reporting two different truths. Prefer assemble, which derives all five from the rows so they cannot disagree.

failed_connections is likewise derived from the rows, so a partial failure is nameable rather than hidden behind an aggregate that reads like a clean tick (RELEASE_0.1.1 §5 #24).

Fields

no_opbool
pages_fetchedint
live_pagesint
backfill_pagesint
transactions_ingestedint
connectionstuple[ConnectionSyncReport, ...]default ()
failed_connectionspropertyIds of exactly the rows that failed, in breakdown order.

assemble

assemble(cls, connections: Iterable[ConnectionSyncReport]) -> SyncReport

Assemble a tick aggregate from its rows; pinned algorithm.

  • each of pages_fetched, live_pages, backfill_pages and transactions_ingested is the exact int sum over connections: the tick spent one shared budget, so the rows ARE the total.
  • no_op is True iff every row is a no-op; a tick that did work anywhere did work. Zero connections is a no-op tick.
  • connections stored as a tuple in input order.

The result satisfies every SyncReport invariant by construction, so the aggregate can never be typed out of agreement with its breakdown.

Parameters

connectionsrequired, Iterable[ConnectionSyncReport]

none

__init__

__init__(self, no_op: bool, pages_fetched: int, live_pages: int, backfill_pages: int, transactions_ingested: int, connections: tuple[ConnectionSyncReport, ...] = ()) -> None

Parameters

no_oprequired, bool

none

pages_fetchedrequired, int

none

live_pagesrequired, int

none

backfill_pagesrequired, int

none

transactions_ingestedrequired, int

none

connectionsoptional, tuple[ConnectionSyncReport, ...], default ()

none