Skip to main content

AgentHandlerV2

Trait AgentHandlerV2 

Source
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§

Source

fn capabilities(&self) -> AgentCapabilities

Get agent capabilities.

Provided Methods§

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn health_status(&self) -> HealthStatus

Get current health status.

Source

fn metrics_report(&self) -> Option<MetricsReport>

Get current metrics report (if metrics export is enabled).

Source

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.

Source

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.

Source

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,

Handle a drain request.

Source

fn on_stream_closed<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when the stream is closed.

Implementors§