Make negative_caching_list/negative_revalidating_list overridable
Alternative approach of #12206 to override HTTP Status Code list in the config.
PR #12206 has a overhead because the per-remap configuration list was stored as a string and parsed on every transactions. This PR avoids that cost by parsing the string once at config-load time by introducing new TS APIs.
New TS APIs Proposal
TS_RECORDDATATYPE_VARIANT
using TSConfigValue = std::variant<HttpStatusCodeList *>;
TSReturnCode TSHttpTxnConfigParse(TSConfigValue &dst, TSOverridableConfigKey key, const char *value, size_t length);
TSReturnCode TSHttpTxnConfigSet(TSHttpTxn txnp, TSOverridableConfigKey key, const TSConfigValue &src);
TSHttpTxnConfigParse parses given string into appropriate data structure and stores it in a TSConfigValue. It's a variant of data structures. TSHttpTxnConfigSet set the parsed TSConfigValue to the transaction to override a variable.
TSConfigValue is a std::variant for type safety and future extension.
Usage
The changes in conf_remap illustrate how to use the new APIs.
- (Re)loading config: Parse the config string into
HttpStatusCodeList *byTSHttpTxnConfigParseand store it in theTSConfigValue - Remap: Override the variable by
TSHttpTxnConfigSet
Out of scope
The HttpStatusBitSet container could be replaced by std::unordered_set or similar to reduce memory usage, but that refactoring is intentionally left for a future PR.
After talked with @zwoop, this is trying to combine current type specific set APIs into one TSHttpTxnConfigSet.
This is getting big change, so let me divide into 2 steps.
1). Make negative_caching_list/negative_revalidating_list overridable with MgmtConverter
2). Fix overhead of MgmtConverter by introducing new TS APIs.
This pull request has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community.