arizona_roadrunner_controller (arizona_roadrunner v0.1.0)

View Source

Roadrunner handler for controller routes: runs arizona_controller:dispatch/3 and maps its reply onto roadrunner's response shapes.

A controller route ({get, ...}/{post, ...}/.../{match, ...}) compiles to this dispatcher (the way {live, ...} routes go through arizona_roadrunner_http). Roadrunner has every t:arizona_controller:reply/0 kind, so each maps one to one; a loop's state carries the controller module, so handle_info/3 reaches it, and roadrunner's {roadrunner_disconnect, Reason} reaches it as {arizona_disconnect, Reason}.

Summary

Functions

Roadrunner handle/1 callback. Dispatches the controller route and hands roadrunner back the request the action returned, whose body reader a manual body read advanced.

Roadrunner handle_info/3 callback for a {loop, ...} reply: hands each message to the controller's own handle_info/3.

Functions

handle(Req)

-spec handle(Req) -> {Response, Req}
                when Req :: roadrunner_req:request(), Response :: roadrunner_handler:response().

Roadrunner handle/1 callback. Dispatches the controller route and hands roadrunner back the request the action returned, whose body reader a manual body read advanced.

handle_info(Info, Push, State)

-spec handle_info(Info, Push, State) -> {ok, State} | {stop, State}
                     when
                         Info :: term(),
                         Push :: roadrunner_handler:push_fun(),
                         State :: {module(), term()}.

Roadrunner handle_info/3 callback for a {loop, ...} reply: hands each message to the controller's own handle_info/3.