Description
Supplies bounded, synchronous around-handler composition for applications.
Add
procedure Add
(Item : in out Pipeline;
Component : not null Middleware_Access)
Append one component in deterministic outer-to-inner order.
Parameters
- Item
Pipeline being configured
- Component
Around-handler component
Raised exceptions
- Constraint_Error
Pipeline capacity is exhausted
App_Context
type App_Context is limited private;
Application context shared by middleware and endpoints.
Call
procedure Call
(Item : in out Next_Handler;
Context : in out App_Context;
X : in out App.Exchange)
Invoke the next component once. A second invocation raises Program_Error instead of running application work twice.
Parameters
- Item
Borrowed continuation
- Context
Typed application context
- X
Borrowed request exchange
Execute
procedure Execute
(Item : aliased in out Pipeline;
Context : in out App_Context;
X : in out App.Exchange;
Terminal : not null Handler_Access)
Execute the pipeline and terminal endpoint synchronously. Item, X, and every continuation remain borrowed until this call returns.
Parameters
- Item
Configured middleware pipeline
- Context
Typed application context
- X
Borrowed request exchange
- Terminal
Final application endpoint
Failure_Kind
type Failure_Kind is
(Protocol_Failure,
Timeout_Failure,
Cancellation_Failure,
Resource_Failure,
Transport_Failure,
Application_Failure);
Failure category supplied to application logging.
Enumeration literals
- Protocol_Failure
Invalid HTTP protocol state
- Timeout_Failure
Absolute deadline expired
- Cancellation_Failure
Cancellation was requested
- Resource_Failure
Bounded server resource was unavailable
- Transport_Failure
Socket or TLS transport failed
- Application_Failure
Application or middleware raised unexpectedly
Handler_Access
type Handler_Access is access procedure
(Context : in out App_Context;
X : in out App.Exchange);
Terminal application endpoint.
Parameters
- Context
Typed application context
- X
Borrowed request exchange
Invoked
function Invoked (Item : Next_Handler) return Boolean
Report whether a continuation has already been invoked.
Parameters
- Item
Borrowed continuation
Return value
True after Call
Middleware_Access
type Middleware_Access is access procedure
(Context : in out App_Context;
X : in out App.Exchange;
Next : in out Next_Handler);
Around-handler component. Call Next exactly once to continue, omit the call to short circuit, and perform post-response work after it returns.
Parameters
- Context
Typed application context
- X
Borrowed request exchange
- Next
Borrowed single-use downstream continuation
Next_Handler
type Next_Handler is tagged limited private;
Single-use continuation for one around-handler invocation. The value borrows its pipeline and must not escape the middleware call.
No_Error_Log
procedure No_Error_Log
(Kind : Failure_Kind;
Error : Ada.Exceptions.Exception_Occurrence;
X : in out App.Exchange)
Default no-op error logger.
Parameters
- Kind
Failure category
- Error
Captured exception occurrence
- X
Borrowed request exchange
No_Error_Map
procedure No_Error_Map
(Context : in out App_Context;
X : in out App.Exchange;
Error : Ada.Exceptions.Exception_Occurrence;
Handled : in out Boolean)
Default application exception mapper, which leaves Handled false.
Parameters
- Context
Typed application context
- X
Borrowed request exchange
- Error
Captured exception occurrence
- Handled
Set true only after safely mapping the exception
Pipeline
type Pipeline (Capacity : Positive := 16) is tagged limited private;
Fixed-capacity middleware sequence. Configure it before concurrent use.
Record fields
- Capacity
Maximum registered components