Repository navigation
state: add per-app instance(app&)/instancePtr(app&) overloads - #30
Merged
Merged
Conversation
Adds additive overloads that lazily create and cache a root state on the given app's data map, decoupling state ownership from app::instance(). Existing zero-arg state::instance() now delegates to instance(app::instance()), preserving behavior for all callers. Startup callbacks still fire once per process. Future PRs can migrate xmlrpc_server and other singleton callers to ctx-aware form before the cvcstate macro is finally retired.
This was referenced May 3, 2026
transfix
added a commit
that referenced
this pull request
May 4, 2026
…macro (#36) All production and test callers now route through cvc::state::instance(app&) (see PRs #30-#35). Remove the deprecated singleton API surface: - cvcstate macro (inc/cvc/state.h) - cvc::state::instance() zero-arg overload (declaration + definition) - cvc::state::instancePtr() zero-arg shim - state::_instance static cache and the &ctx == &app::instance() cache-write block in instancePtr(app&) State roots are now exclusively per-app, stored on the app's data map under "__state". 590/590 with CVC_USING_XMLRPC=ON and OFF locally.
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.
Phase D groundwork. Additive only.
Adds overloads that lazily create and cache a root
stateon the given app's data map, decoupling state ownership fromapp::instance(). Existing zero-argstate::instance()now delegates toinstance(app::instance())so all current callers (cvcstatemacro included) preserve behavior.Startup callbacks fire once per process via a one-shot guard.
Local: 590/590 tests pass. Lays groundwork for migrating xmlrpc_server and remaining singleton call sites to ctx-aware form before retiring the
cvcstatemacro andapp::instance().