Commit Graph

8 Commits

Author SHA1 Message Date
Ryan Nowak f8b3b73ca7 Remove EndpointConstraints
Adds IEndpointSelectorPolicy so that MVC can plug in to the
EndpointSelector to run action constraints.
2018-07-28 19:03:12 -07:00
Ryan Nowak 147c9527f3
Implement EndpointSelector and MatcherPolicy (#646)
Implement EndpointSelector and MatcherPolicy

This change makes the EndpointSelector API more concrete, and is the
beggining of removing EndpointConstraint by making it obsolete.

To that end, I'm introducing MatcherPolicy, which is a
feature-collection API for registering policies that interact with the
DfaMatcher. The two policies that we'll need to start are:
- ability to order endpoints
- ability to append 'policy' nodes to the graph

These two concepts together replace EndpointConstraint. Extending our
graph representation is a really efficient way to processing most common
scenarios.

---

In general this helps with common cases where 4 or so endpoints match
the URL, but with different HTTP methods supported on each. Today we
have to process route values and call into some 'policy' to make a
decision about which one is the winner. This change pushes this
knowledge down into the graph so that it's roughly as cheap as a
dictionary lookup, and can be done allocation-free.

The big savings here is ability to remove more candidates *before*
collecting route data.

---

Along with this change, I also built 'rejection' into the DFA node
model, you can see an example with the HTTP Method handling that I
implemented. I implemented a policy that can treat failure to resolve an
HTTP method as a 405 response by returning a failure endpoint. This is
at the heart of much of the feedback we've gotten in this area around
versioning and http method handling. We also have a version of this
feature in MVC for [Consumes].
2018-07-24 17:31:51 -07:00
Ryan Nowak f1c060bf3d RoutePattern everywhere 2018-07-20 13:04:34 -07:00
Ryan Nowak 400d243f42
Fix remaining feature gaps in DfaMatcher (#621)
* Fix remaining feature gaps in DfaMatcher

* addressed minor feedback

* missed one
2018-07-17 19:22:46 -07:00
Ryan Nowak b2e4743c7d
Change benchmarks (#612)
Add benchmarks that include some HTTP method matching.

Clean up names and name like-kinded benchmarks alphabetically.

Matcher*Benchmark -> E2E including HTTP method selection
MatcherSelectCandidates*Benchmark -> Focused on just URL path processing
2018-07-14 17:21:05 -07:00
Kiran Challa 1009705283 Added a RouteValuesBasedEndpointFinder 2018-06-28 10:53:10 -07:00
Ryan Nowak db95a8c624 Add more matcher tests
This is a code dump of existing tests for TemplateMatcher and TreeRouter
converted to the format of matcher conformance tests.

Note that most of the new tests aren't yet supported by our experimental
matchers, which don't support many of these advanced features.
2018-06-20 10:39:53 -07:00
Ryan Nowak 00e99dbbb2 Flesh out experimental matchers
This change improves this area a bit by consolidating the matcher
implementations between the benchmarks project and the conformance
tests.

Additionally I split the minimal matcher into a really trivial
implementation for the simple tests and a more complex one for the
larger tests. This allows us to keep the plaintext/techempower scenario
in sight while also having a good baseline for the more sophisticated
tests.

Also starting to add tests that verify that matchers behave as expected.

The matchers now successfully execute all of these benchmarks, which
means that they support literals and parameters.

Missing features:
- complex segments
- catchall
- default values
- optional parameters
- constraints
- complex segments with file extensions

This is a good place to iterate a bit more of perf and try to make a
decision about what we want to implement.
2018-06-15 15:43:50 -07:00