Expand description
Composable middleware pipeline for request processing.
Provides a MiddlewarePipeline that executes a chain of Middleware
implementations in order. Each middleware can inspect/modify the
RequestContext, optionally short-circuit the pipeline (e.g. on auth
failure), or let processing continue by calling Next::run.
§Built-in middleware
| Middleware | Purpose |
|---|---|
LoggingMiddleware | Logs request/response with duration |
MetricsMiddleware | Records operation metrics |
AuthMiddleware | API-key / JWT authentication |
RateLimitMiddleware | Token-bucket rate limiting |
TracingMiddleware | Creates a tracing span per request |
Structs§
- Auth
Middleware - Validates authentication credentials found in request metadata.
- Logging
Middleware - Logs every request and its outcome.
- Metrics
Middleware - Records request metrics via the existing
MetricsCollector. - Middleware
Pipeline - An immutable, ordered pipeline of middleware.
- Middleware
Pipeline Builder - Builder for
MiddlewarePipeline. - Rate
Limit Middleware - Simple token-bucket rate limiter.
- Request
Context - Context that travels through the middleware pipeline.
- Response
- Response wrapper returned by the middleware pipeline.
- Tracing
Middleware - Creates a tracing span around the remainder of the pipeline.
Enums§
- LogLevel
- Log verbosity used by
LoggingMiddleware. - Middleware
Error - Errors that can occur in the middleware pipeline.
- Response
Status - Status of a middleware response.
Traits§
- Middleware
- Trait implemented by each middleware layer.
- Next
- Trait for the “rest of the pipeline” that a middleware calls to continue.