Skip to content

Commit 0136578

Browse files
etrclaude
andcommitted
refactor: rename route_tier_kind::pattern to ::regex
The pattern tier is the regex tier everywhere else in the code (regex_routes_, the compiled std::regex, the "regex tier" prose). Unify the enum member with that vocabulary so the three tiers read exact / radix / regex. Pure rename; no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent de0c334 commit 0136578

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/detail/webserver_register.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ void webserver_impl::reject_duplicate_v2_entry_(
186186
throw_duplicate_registration(key);
187187
}
188188
break;
189-
case route_tier_kind::pattern:
189+
case route_tier_kind::regex:
190190
for (const auto& rr : regex_routes_) {
191191
if (rr.url_complete == key) throw_duplicate_registration(key);
192192
}
@@ -228,7 +228,7 @@ void webserver_impl::register_v2_route(const detail::http_endpoint& idx,
228228
param_and_prefix_routes_.insert(idx.get_url_complete(), std::move(entry),
229229
/*is_prefix=*/false);
230230
break;
231-
case route_tier_kind::pattern:
231+
case route_tier_kind::regex:
232232
regex_routes_.push_back(
233233
{idx.get_url_complete(), std::move(*tier.re), std::move(entry)});
234234
break;

src/detail/webserver_routes_upsert.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ void webserver_impl::insert_fresh_v2_entry(const detail::http_endpoint& idx,
306306
exact_routes_.emplace(idx.get_url_complete(),
307307
make_non_prefix_entry(methods, std::move(shim)));
308308
break;
309-
case route_tier_kind::pattern:
309+
case route_tier_kind::regex:
310310
// Regex-tier routes do not conflict with prefix routes because
311311
// a literal pattern with regex metacharacters is its own key
312312
// (it never matches as a prefix lookup target).

src/httpserver/detail/route_tier.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,14 @@ namespace detail {
5858
//
5959
// Inline so both webserver_register.cpp and webserver_routes.cpp can call
6060
// it without picking up a TU boundary.
61-
// 'pattern' names the regex tier; the label is self-describing:
62-
// routes in this tier match by compiled regex pattern.
63-
enum class route_tier_kind { exact, radix, pattern };
61+
// 'regex' names the regex tier; routes in this tier match by compiled
62+
// regex pattern (as opposed to the exact hash tier and the radix
63+
// parameterized-path tier).
64+
enum class route_tier_kind { exact, radix, regex };
6465

6566
struct route_tier_result {
6667
route_tier_kind kind = route_tier_kind::exact;
67-
std::optional<std::regex> re; // populated iff kind == pattern
68+
std::optional<std::regex> re; // populated iff kind == regex
6869
};
6970

7071
inline route_tier_result classify_route_tier(const detail::http_endpoint& idx) {
@@ -102,7 +103,7 @@ inline route_tier_result classify_route_tier(const detail::http_endpoint& idx) {
102103
if (std::regex_match(idx.get_url_complete(), re)) {
103104
res.kind = route_tier_kind::exact;
104105
} else {
105-
res.kind = route_tier_kind::pattern;
106+
res.kind = route_tier_kind::regex;
106107
res.re = std::move(re);
107108
}
108109
return res;

0 commit comments

Comments
 (0)