the state function, when passed to the castra middleware, further
segregates an application's command and query responsibilities. by
assuming the duty of updating the application state, the state function
frees rpc commands to return their own results to the application.
the middleware first executes the command to mutate the application data,
then evaluates the state function to query it. both the result and the
piggybacking application data are returned over the same http response
and mapped respectively to the call site and reference type.
the state function, when passed to the castra middleware, further segregates an application's command and query responsibilities. by assuming the duty of updating the application state, the state function frees rpc commands to return their own results to the application.
the middleware first executes the command to mutate the application data, then evaluates the state function to query it. both the result and the piggybacking application data are returned over the same http response and mapped respectively to the call site and reference type.