pub trait AgentHandlerV2: Send + Sync {
Show 14 methods
// Required method
fn capabilities(&self) -> AgentCapabilities;
// Provided methods
fn on_handshake<'life0, 'async_trait>(
&'life0 self,
_request: HandshakeRequest,
) -> Pin<Box<dyn Future<Output = HandshakeResponse> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn on_request_headers<'life0, 'async_trait>(
&'life0 self,
_event: RequestHeadersEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn on_request_body_chunk<'life0, 'async_trait>(
&'life0 self,
_event: RequestBodyChunkEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn on_response_headers<'life0, 'async_trait>(
&'life0 self,
_event: ResponseHeadersEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn on_response_body_chunk<'life0, 'async_trait>(
&'life0 self,
_event: ResponseBodyChunkEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn on_request_complete<'life0, 'async_trait>(
&'life0 self,
_event: RequestCompleteEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn on_websocket_frame<'life0, 'async_trait>(
&'life0 self,
_event: WebSocketFrameEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn health_status(&self) -> HealthStatus { ... }
fn metrics_report(&self) -> Option<MetricsReport> { ... }
fn on_configure<'life0, 'async_trait>(
&'life0 self,
_config: Value,
_version: Option<String>,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn on_shutdown<'life0, 'async_trait>(
&'life0 self,
_reason: ShutdownReason,
_grace_period_ms: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn on_drain<'life0, 'async_trait>(
&'life0 self,
_duration_ms: u64,
_reason: DrainReason,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn on_stream_closed<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
v2 agent handler trait.
Implement this trait to create a v2 agent. The v2 handler adds:
- Capability reporting
- Health reporting
- Flow control awareness
- Metrics export
- Configuration updates
Required Methods§
Sourcefn capabilities(&self) -> AgentCapabilities
fn capabilities(&self) -> AgentCapabilities
Get agent capabilities.
Provided Methods§
Sourcefn on_handshake<'life0, 'async_trait>(
&'life0 self,
_request: HandshakeRequest,
) -> Pin<Box<dyn Future<Output = HandshakeResponse> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_handshake<'life0, 'async_trait>(
&'life0 self,
_request: HandshakeRequest,
) -> Pin<Box<dyn Future<Output = HandshakeResponse> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle handshake request.
Sourcefn on_request_headers<'life0, 'async_trait>(
&'life0 self,
_event: RequestHeadersEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_request_headers<'life0, 'async_trait>(
&'life0 self,
_event: RequestHeadersEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle a request headers event.
Sourcefn on_request_body_chunk<'life0, 'async_trait>(
&'life0 self,
_event: RequestBodyChunkEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_request_body_chunk<'life0, 'async_trait>(
&'life0 self,
_event: RequestBodyChunkEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle a request body chunk event.
Sourcefn on_response_headers<'life0, 'async_trait>(
&'life0 self,
_event: ResponseHeadersEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_response_headers<'life0, 'async_trait>(
&'life0 self,
_event: ResponseHeadersEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle a response headers event.
Sourcefn on_response_body_chunk<'life0, 'async_trait>(
&'life0 self,
_event: ResponseBodyChunkEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_response_body_chunk<'life0, 'async_trait>(
&'life0 self,
_event: ResponseBodyChunkEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle a response body chunk event.
Sourcefn on_request_complete<'life0, 'async_trait>(
&'life0 self,
_event: RequestCompleteEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_request_complete<'life0, 'async_trait>(
&'life0 self,
_event: RequestCompleteEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle a request complete event.
Sourcefn on_websocket_frame<'life0, 'async_trait>(
&'life0 self,
_event: WebSocketFrameEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_websocket_frame<'life0, 'async_trait>(
&'life0 self,
_event: WebSocketFrameEvent,
) -> Pin<Box<dyn Future<Output = V1Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle a WebSocket frame event.
Sourcefn health_status(&self) -> HealthStatus
fn health_status(&self) -> HealthStatus
Get current health status.
Sourcefn metrics_report(&self) -> Option<MetricsReport>
fn metrics_report(&self) -> Option<MetricsReport>
Get current metrics report (if metrics export is enabled).
Sourcefn on_configure<'life0, 'async_trait>(
&'life0 self,
_config: Value,
_version: Option<String>,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_configure<'life0, 'async_trait>(
&'life0 self,
_config: Value,
_version: Option<String>,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle a configuration update from the proxy.
Sourcefn on_shutdown<'life0, 'async_trait>(
&'life0 self,
_reason: ShutdownReason,
_grace_period_ms: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_shutdown<'life0, 'async_trait>(
&'life0 self,
_reason: ShutdownReason,
_grace_period_ms: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle a shutdown request.