Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add FDv2DataSystem orchestrator
Orchestrates FDv2 initializers and synchronizers; applies changesets and reports data-source status.
What's implemented
FDv2DataSystem—IDataSystemimpl. Runs initializers, then a synchronizer; applies changesets; tracks the selector; emits status (kInitializing→kValidon first apply /kInterruptedon errors →kOffon destruction). Offline (no factories) goes straight tokValid.IFDv2InitializerFactory,IFDv2SynchronizerFactory— build a fresh source per call.ITransactionalDestination— extendsIDestinationwithApply(ChangeSet); implemented byMemoryStoreandChangeNotifier.ChangeNotifier::Apply— diffs against the current store, updates the dependency tracker, applies to the sink, emits change events. Full diffs per-kind and version-aware; Partial notifies unconditionally per item.Design decisions
shared_ptr<State>for orchestrator-level async safety. Other FDv2 components keep async state in ashared_ptr<State>so callbacks can outlive the public object. This one capturesthisdirectly — safe because~ClientImpldoesioc_.stop()andrun_thread_.join()before destroying the data system. The destructor's precondition (caller drains the executor first) is documented on the class.ITransactionalDestinationrather than addingApplytoIDestination. Leaves the FDv1 persistent-store path untouched.DataSourceStatusManageris non-owning.ClientImpl(shared with FDv1) is its sole owner; the data system only borrows it. Declaration order inClientImplguarantees the manager outlives the data system.Test plan
11 cases in
libs/server-sdk/tests/fdv2_data_system_test.cppcover lifecycle, initializer phase (basis received, basis-skips-remaining, Interrupted advances, ChangeSet without selector continues), and synchronizer phase (apply, Interrupted loops, Goodbye/TerminalError advances, selector forwarding). Mocks resolve futures synchronously; tests run the io_context to drain orchestration before assertions.