arizona_roadrunner_req (arizona_roadrunner v0.1.0)

View Source

Roadrunner adapter for the arizona_req behaviour.

Implements the parsing callbacks by delegating each to the matching roadrunner_req primitive. new/1 wraps a raw roadrunner request in an arizona_req:request() with method and path eagerly populated and everything else lazy-loaded on first access.

Summary

Functions

Wraps a roadrunner request in an arizona_req:request() with method, path, and roadrunner's request_id eagerly populated. The request_id is the same 16-char hex token roadrunner mirrors into its logger metadata, so Arizona-side handlers and crash reports can be correlated with the adapter's access logs.

Resolves a path to {ok, Handler, RouteOpts, Request} by running the roadrunner router against the compiled routes stashed in persistent_term, or error when the path does not resolve to a live route (no match, a non-live controller/asset/ws route, or a method mismatch).

Functions

new(RoadrunnerReq)

-spec new(RoadrunnerReq) -> arizona_req:request() when RoadrunnerReq :: roadrunner_req:request().

Wraps a roadrunner request in an arizona_req:request() with method, path, and roadrunner's request_id eagerly populated. The request_id is the same 16-char hex token roadrunner mirrors into its logger metadata, so Arizona-side handlers and crash reports can be correlated with the adapter's access logs.

parse_bindings(RoadrunnerReq)

-spec parse_bindings(RoadrunnerReq) -> arizona_req:bindings()
                        when RoadrunnerReq :: roadrunner_req:request().

parse_cookies(RoadrunnerReq)

-spec parse_cookies(RoadrunnerReq) -> arizona_req:cookies()
                       when RoadrunnerReq :: roadrunner_req:request().

parse_headers(RoadrunnerReq)

-spec parse_headers(RoadrunnerReq) -> arizona_req:headers()
                       when RoadrunnerReq :: roadrunner_req:request().

parse_params(RoadrunnerReq)

-spec parse_params(RoadrunnerReq) -> arizona_req:params() when RoadrunnerReq :: roadrunner_req:request().

peer(RoadrunnerReq)

-spec peer(RoadrunnerReq) -> {inet:ip_address(), inet:port_number()} | undefined
              when RoadrunnerReq :: roadrunner_req:request().

read_body(RoadrunnerReq)

-spec read_body(RoadrunnerReq) ->
                   {ok, arizona_req:body(), RoadrunnerReq} | {error, arizona_req:body_error()}
                   when RoadrunnerReq :: roadrunner_req:request().

resolve_route(Path, Qs, Req)

-spec resolve_route(Path, Qs, Req) -> {ok, Handler, RouteOpts, ArzReq} | error
                       when
                           Path :: arizona_req:path(),
                           Qs :: arizona_req:qs(),
                           Req :: roadrunner_req:request(),
                           Handler :: module(),
                           RouteOpts :: arizona_live:route_opts(),
                           ArzReq :: arizona_req:request().

Resolves a path to {ok, Handler, RouteOpts, Request} by running the roadrunner router against the compiled routes stashed in persistent_term, or error when the path does not resolve to a live route (no match, a non-live controller/asset/ws route, or a method mismatch).

On success returns the handler's static route options (including its bindings config) untouched, plus a navigate-scoped arizona_req:request() synthesized from the stored upgrade request with the new path, target, and matched bindings applied.

scheme(RoadrunnerReq)

-spec scheme(RoadrunnerReq) -> arizona_req:scheme() when RoadrunnerReq :: roadrunner_req:request().