You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
A binary that embeds mcrouter sometimes needs a route handle that sees *every*
request — an interceptor, a local overlay, a shim in front of production. Today
the only way to get one is to author or rewrite the routing config, which means
knowing how that config expresses its entry point (`route` vs `routes`, alias
lists, `PrefixSelectorRoute` policies), reproducing whatever the config would
otherwise have routed to, and re-doing all of it whenever that config changes.
Configs that reach their entry point through JSONM macros cannot be edited that
way at all, since the leaves do not exist until the preprocessor has run.
Give binaries a way to say "put this on top" and let mcrouter resolve the config
normally.
`ExtraRouteHandleProviderIf::wrapRoot()` is a new hook, defaulting to identity,
called from `ProxyRoute`'s constructor once the root handle is built. It is
applied after the existing `BigValueRoute` and `LoggingRoute` wrappers and above
routing prefix selection, so the injected handle sees every request and is
created exactly once per proxy, whatever shape the loaded config has.
`McRouteHandleProvider::extraProvider()` exposes the provider so `ProxyConfig`
can pass it to `ProxyRoute`, alongside the `release*()` accessors it already
calls on that object a few lines earlier.
Nothing changes for existing routers: the `ProxyRoute` parameter defaults to
`nullptr`, and no in-tree provider overrides `wrapRoot()` in this diff, so every
current mcrouter builds an identical route handle tree.
The first user is TAO Sandbox's `mock_tao` / `mock_ucache` (next in this stack).
It needs `MockTaoRoute` / `MockUcacheRoute` in front of whatever config the
flavor and the host's `/etc/mcrouter` overrides resolve to; today it hand-writes
a config that bypasses both and has drifted from the real one as a result.
Reviewed By: ghostonhuang
Differential Revision: D116661224
fbshipit-source-id: e07f7a2f69ca3e95cc35aaf4275d126841ab8964
0 commit comments