Repository navigation
Commit 983c33d
authored
feat: Add the FDv2 data system orchestrator (#190)
## Summary
Adds the FDv2 orchestrator, the `DataSystem` implementation that owns
the
in-memory store and keeps it populated. It runs an initializer phase to
obtain
a basis, then a synchronizer phase for ongoing changes.
The initializer phase tries each initializer in order until one produces
a
basis. The synchronizer phase then runs one synchronizer at a time and
rotates
between them on three triggers:
- A fallback timer advances to the next synchronizer after a sustained
interruption.
- A recovery timer returns to the primary synchronizer after the
recovery
interval.
- A terminal error blocks a synchronizer and advances past it.
Initialization is signaled as complete on the first basis and as failed
once
every source is exhausted without one, because the client's
initialization path
already resolves to success or failure. Synchronizer status transitions
are
logged, with interruptions at info (not repeated while ongoing) and
terminal
errors at warn.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Overview**
> Introduces **`FDv2DataSystem`**, the FDv2 **`DataSystem`**
implementation that owns an in-memory store and keeps it updated via a
two-phase async **`run`** loop spawned from **`start`**.
>
> **Initializer phase** walks factory-built initializers until one
returns a **basis** (full changeset with a selector), applying each
non-`None` changeset and signaling **`init_complete(true)`** once any
full payload lands (after the initializer chain when needed).
**Synchronizer phase** drives one synchronizer at a time through
**`SourceManager`**: cyclic rotation, blocking on terminal errors,
**fallback** after sustained **`Interrupted`**, and **recovery** back to
the prime when a backup source was active. Selectors are passed into
**`next`** and updated per changeset rules (`None` kind preserves
selector; selectorless partial clears it).
>
> Wires the module in **`fdv2/mod.rs`** and drops **`dead_code`**
allowances on **`ChangeSet::selector`** and
**`TransactionalDataStore::apply`** now that the orchestrator consumes
them. Adds a large **`#[cfg(test)]`** suite covering init/failure,
rotation, timers, and selector edge cases.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f8ccaf3. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent d1c3f17 commit 983c33d
4 files changed
Lines changed: 1224 additions & 2 deletions
0 commit comments