pub struct HandlerLimits {
pub max_id_length: usize,
pub max_metadata_size: usize,
pub max_cancellation_tokens: usize,
pub max_token_age: Duration,
pub push_delivery_timeout: Duration,
pub max_artifacts_per_task: usize,
}Expand description
Configurable limits for the request handler.
All fields have sensible defaults. Create with HandlerLimits::default()
and override individual values as needed.
§Example
use a2a_protocol_server::handler::HandlerLimits;
let limits = HandlerLimits::default()
.with_max_id_length(2048)
.with_max_metadata_size(2 * 1024 * 1024);Fields§
§max_id_length: usizeMaximum allowed length for task/context IDs. Default: 1024.
max_metadata_size: usizeMaximum allowed serialized size for metadata fields in bytes. Default: 1 MiB.
max_cancellation_tokens: usizeMaximum cancellation token map entries before cleanup sweep. Default: 10,000.
max_token_age: DurationMaximum age for cancellation tokens. Default: 1 hour.
push_delivery_timeout: DurationTimeout for individual push webhook deliveries. Default: 5 seconds.
Bounds how long the handler waits for a single push notification delivery to complete, preventing one slow webhook from blocking all subsequent deliveries.
max_artifacts_per_task: usizeMaximum number of artifacts per task. Default: 1000.
Prevents unbounded memory growth and O(n²) serialization cost when executors emit many artifacts. Once the limit is reached, new artifact updates are rejected.
Implementations§
Source§impl HandlerLimits
impl HandlerLimits
Sourcepub const fn with_max_id_length(self, length: usize) -> HandlerLimits
pub const fn with_max_id_length(self, length: usize) -> HandlerLimits
Sets the maximum allowed length for task/context IDs.
Sourcepub const fn with_max_metadata_size(self, size: usize) -> HandlerLimits
pub const fn with_max_metadata_size(self, size: usize) -> HandlerLimits
Sets the maximum serialized size for metadata fields in bytes.
Sourcepub const fn with_max_cancellation_tokens(self, max: usize) -> HandlerLimits
pub const fn with_max_cancellation_tokens(self, max: usize) -> HandlerLimits
Sets the maximum cancellation token map entries before cleanup.
Sourcepub const fn with_max_token_age(self, age: Duration) -> HandlerLimits
pub const fn with_max_token_age(self, age: Duration) -> HandlerLimits
Sets the maximum age for cancellation tokens.
Sourcepub const fn with_push_delivery_timeout(
self,
timeout: Duration,
) -> HandlerLimits
pub const fn with_push_delivery_timeout( self, timeout: Duration, ) -> HandlerLimits
Sets the timeout for individual push webhook deliveries.
Sourcepub const fn with_max_artifacts_per_task(self, max: usize) -> HandlerLimits
pub const fn with_max_artifacts_per_task(self, max: usize) -> HandlerLimits
Sets the maximum number of artifacts per task.
Trait Implementations§
Source§impl Clone for HandlerLimits
impl Clone for HandlerLimits
Source§fn clone(&self) -> HandlerLimits
fn clone(&self) -> HandlerLimits
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HandlerLimits
impl Debug for HandlerLimits
Source§impl Default for HandlerLimits
impl Default for HandlerLimits
Source§fn default() -> HandlerLimits
fn default() -> HandlerLimits
Auto Trait Implementations§
impl Freeze for HandlerLimits
impl RefUnwindSafe for HandlerLimits
impl Send for HandlerLimits
impl Sync for HandlerLimits
impl Unpin for HandlerLimits
impl UnsafeUnpin for HandlerLimits
impl UnwindSafe for HandlerLimits
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request