Expand description
Stateful, composable interception of owned protocol messages.
Middleware receives ownership of a decoded message and a mutable reference to caller-defined state. Returning the input unchanged is a no-op; implementations may instead mutate it or return another message of the same type. Protocol session APIs remain responsible for checking that the result is legal in their current state before advancing.
Structs§
- Asynchronous
Backend Message - Validated backend traffic which does not advance the current protocol phase.
- Identity
- Middleware which returns every message unchanged.
- Middleware
- Owns user state and middleware as one reusable interception unit.
- Then
- Two middleware stages evaluated from
firsttosecond. - Wire
Adapter - Adapts one direction-wide wire middleware to every generated typed phase.
Enums§
- Chain
Error - Identifies which stage of a two-part middleware chain failed.
- Client
Role - Marker for middleware handling messages sent by a PostgreSQL client.
- Intercept
Error - Failure while applying or validating middleware output.
- Receive
Error - I/O or interception failure while receiving a middleware-checked message.
- Server
Role - Marker for middleware handling messages sent by a PostgreSQL server.
- Typed
Backend Message - Any server message legal in a phase, including non-advancing asynchronous traffic.
- Typed
Receive Error - Failure while receiving through compile-time phase-checked middleware.
- Wire
Adapter Error - Failure from direction-wide middleware adapted to a typed phase.
Traits§
- Accepts
Message - State-aware validation of one directional protocol message type.
- Message
Middleware - Intercepts an owned message with access to caller-defined state.
- Message
Middleware Ext - Adds composition to every sized middleware implementation.
- Reconstructable
Message - A protocol message which can verify that it has a valid wire representation.
- Typed
Middleware - Middleware whose role, protocol phase, and legal message set are type indexed.
- Typed
Phase - Associates a connection typestate with its generated legal message type.