c9s/Pux

Link r3 for the path dispatching

c9s opened this issue · 2 comments

c9s commented
Link r3 for the path dispatching
c9s commented

9956253 compiler flags updated.

c9s commented

Current plan:

  • Any Mux object should have its own ID for the persistent resource name. we can have a setId or setName 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.
    • Register the tree object to the persistent table.
    • Also save one instance to our object storage. (extension)
  • 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

  1. 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)
  2. Simplify the route insertion code.
  3. Remove the route sorting method.