← All compilation units

Flyology.HTTP.Server.Native_Routes

Description

Adapts a routed HTTP handler to a bounded native executor while retaining request parsing, routing, cancellation, and response I/O on the request owner task. Prepare must copy all worker input out of the borrowed exchange; Execute never receives the exchange or connection; Render runs only after native completion on the original request task.

The application owns, sizes, starts, and outlives Executor. Several adapter instances may share it when they use the same Operations instantiation. Short handlers should remain inline because submission and wakeup have a measurable fixed cost.

App_Context

type App_Context is limited private;

Executor

Executor : not null access Operations.Executor;

Handle

procedure Handle
  (Context : in out App_Context;
   X       : in out Flyology.HTTP.Server.Applications.Exchange)

Prepare detached input, submit it without waiting for capacity, suspend until native completion, then render on the request owner. A full or stopping executor receives HTTP 503. Caller cancellation and the current absolute exchange deadline are propagated to Submit and Await. Native exceptions are re-raised with their original identity for the router's normal exception mapper. An unwound or cancelled call abandons its single-use result handle, which requests cooperative worker cancellation and reclaims the slot after completion.

Parameters
Context

Router application context

X

Borrowed exchange owned by the current request task

Input_Type

type Input_Type is private;

Operations

with package Operations is new Flyology.Native_Executors
  (Input_Type  => Input_Type,
   Result_Type => Result_Type,
   Execute     => <>);

Prepare

procedure Prepare
(Context : in out App_Context;
X       : in out Flyology.HTTP.Server.Applications.Exchange;
Input   : out Input_Type)
Parameters
Context
X
Input

Render

procedure Render
(Context : in out App_Context;
X       : in out Flyology.HTTP.Server.Applications.Exchange;
Result  : Result_Type)
Parameters
Context
X
Result

Result_Type

type Result_Type is private;