Link r3 for the path dispatching
c9s opened this issue · 2 comments
c9s commented
Link r3 for the path dispatching
c9s commented
Current plan:
- Any Mux object should have its own ID for the persistent resource name. we can have a
setId
orsetName
method to set the resource name. - Rewrite current
compile
method:- Create a r3 tree object in the
compile
method - Iterating the routes and insert route paths into the tree.
- Convert route options to
r3_route
struct object.
- Convert route options to
- Register the tree object to the persistent table.
- Also save one instance to our object storage. (extension)
- Create a r3 tree object in the
- Rewrite current Mux::dispatch method.
- Retrieve the tree object (from the object storage or from the persistent table)
- Create a
match_entry
object - Call
r3_tree_match
to match the URL. - Return the matched strings as the dynamic variables.
Final Clean Up
- Since we use r3 to insert the patterns, we don't need the PatternCompiler. and the path style is changed to slug-style path. (not sinatra style anymore)
- Simplify the route insertion code.
- Remove the route sorting method.