Bounded OTP facade for asynchronous TypeSafe evaluations inside a GenServer.
use TypeSafeSDK.OTP.Server keeps ordinary GenServer callbacks in the caller
module and adds one callback, handle_evaluation/3. Return
{:evaluate, {tag, state, questions}, inner_state} (or the four-element form
with per-request options) from a callback to start an evaluation without
blocking the server. The eventual {:ok, response} / {:error, error} result
is delivered to handle_evaluation/3 with the same opaque tag.
This module deliberately does not start a global supervisor or own an HTTP
runtime. Callers provide a Task.Supervisor from their application tree and a
normal TypeSafeSDK.Client. max_in_flight bounds pending evaluations for the
server. TypeSafeSDK still delegates HTTP, retries and physical cancellation to
Pristine.
The wrapper scopes every request with its own private Pristine.Cancellation
token. When the caller supplies a cancellation token, a temporary watcher mirrors
caller cancellation into the private token without mutating caller-owned state.
On server shutdown the private token is cancelled before the local task is stopped.
Summary
Types
Return values accepted from asynchronous delegated callbacks.
Return values accepted from handle_call/3.
A request started by a callback without blocking the server.
An opaque correlation term returned unchanged to handle_evaluation/3.
Types
@type async_result(state) :: {:evaluate, evaluation_request(), state} | {:noreply, state} | {:noreply, state, timeout() | :hibernate | {:continue, term()}} | {:stop, term(), state}
Return values accepted from asynchronous delegated callbacks.
@type call_result(state) :: async_result(state) | {:reply, term(), state} | {:reply, term(), state, timeout() | :hibernate | {:continue, term()}} | {:stop, term(), term(), state}
Return values accepted from handle_call/3.
A request started by a callback without blocking the server.
@type tag() :: term()
An opaque correlation term returned unchanged to handle_evaluation/3.
Callbacks
@callback handle_call(term(), GenServer.from(), term()) :: call_result(term())
@callback handle_cast(term(), term()) :: async_result(term())
@callback handle_continue(term(), term()) :: async_result(term())
@callback handle_info(term(), term()) :: async_result(term())
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec start_link(module(), keyword()) :: GenServer.on_start()
Start a wrapped module.
Required options are :client and :task_supervisor. Optional wrapper options
are :init_arg, :max_in_flight (default 32), and :evaluation_options.
Standard GenServer start options such as :name are also accepted.