1.2 KiB
1.2 KiB
Architecture
FastPathRouter is split into a small public API and an internal compiler/matcher pipeline.
-
Builder Routes are added to
RouterBuilderusing structuredRoutePatternsegments. The builder assigns parameter key ids and collects handler bindings. -
Compile / freeze Routes are compiled into a graph and then frozen into immutable arrays. The compile pipeline lives in
dev.relism.fpr.core.internal.compile:
RouteCompilerorchestrates the process.RouteGraphis the intermediate state/edge graph.FreezeWriteremits primitive arrays and the blob.IndexBuilderbuilds per-state first-byte indexes.
- Match
Matching walks the input path by segments, compares bytes, and records param spans in a reusable
MatchResultcontainer. Runtime pieces live indev.relism.fpr.core.internal.runtime:
FrozenRouteris the match loop and state transitions.EdgeDispatchselects candidate edges for a state.SegmentMatcherevaluates a single segment (literal/mixed/param/wild).ByteCompareperforms bulk byte comparisons.
No Strings or Maps are created during matching.
If you need params as name/value pairs, MatchResult.forEachParam can stream spans via ParamConsumer without allocations.