Skip to content

Commit

Permalink
Add mcrouter runtime features for ODSL
Browse files Browse the repository at this point in the history
Summary: Support to dynamically turn on/off features via routing config. Used initially for ODSL feature.

Reviewed By: djvaporize

Differential Revision: D53374529

fbshipit-source-id: c927a3e2a67382477ca60d83823ae2644d62df76
  • Loading branch information
Stuart Clark authored and facebook-github-bot committed Feb 20, 2024
1 parent 6c8d36b commit 616cd69
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mcrouter/CarbonRouterInstanceBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,16 @@ class CarbonRouterInstanceBase {
axonProxyClientFactory_ = std::move(clientFactory);
}

/**
* Runtime features that can be enabled from runtime_features block
* in routing config
*/
struct RuntimeFeatures {
std::atomic<bool> enableOdslScuba = false;
std::atomic<bool> enableOdslODS = false;
};
RuntimeFeatures runtimeFeatures_;

protected:
void resetMetadata() {
metadata_.reset();
Expand Down
5 changes: 5 additions & 0 deletions mcrouter/ProxyConfig-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ ProxyConfig<RouterInfo>::ProxyConfig(

bool enableAsyncDlBroadcast = readBool("enable_async_dl_broadcast", false);

proxy.router().runtimeFeatures_.enableOdslScuba =
readBool("enable_odsl_scuba", false);
proxy.router().runtimeFeatures_.enableOdslODS =
readBool("enable_odsl_ods", false);

proxyRoute_ = std::make_shared<ProxyRoute<RouterInfo>>(
proxy,
routeSelectors,
Expand Down

0 comments on commit 616cd69

Please sign in to comment.