#[non_exhaustive]pub struct GrpcTransportConfig {
pub timeout: Duration,
pub send_timeout: Duration,
pub connect_timeout: Duration,
pub max_message_size: usize,
pub stream_channel_capacity: usize,
pub http2_keep_alive_interval: Option<Duration>,
pub http2_keep_alive_timeout: Duration,
pub bare_address_scheme: GrpcBareAddressScheme,
pub tls_config: Option<ClientTlsConfig>,
}grpc only.Expand description
Configuration for the gRPC transport.
§Example
use a2a_protocol_client::transport::grpc::GrpcTransportConfig;
use std::time::Duration;
let config = GrpcTransportConfig::default()
.with_timeout(Duration::from_secs(60))
.with_max_message_size(8 * 1024 * 1024);#[non_exhaustive]: build it with Default and the with_* setters.
Struct literals and ..Default::default() are not available outside this
crate, so a field added later does not break callers.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.timeout: DurationRequest timeout for unary calls. Default: 30 seconds.
send_timeout: DurationHow long a blocking SendMessage waits for the agent’s turn.
Default: DEFAULT_SEND_TIMEOUT.
connect_timeout: DurationConnection timeout. Default: 10 seconds.
max_message_size: usizeMaximum inbound message size. Default: 4 MiB.
stream_channel_capacity: usizeChannel capacity for streaming responses. Default: 64.
http2_keep_alive_interval: Option<Duration>How often an HTTP/2 PING is sent on the connection, quiet or not, so
that a load balancer’s idle timeout does not close a long, silent
stream and a peer that vanished is found out (audit B-10, D-12).
None, the default, sends none: a PING is hop-by-hop, so it keeps
only the hop to the nearest proxy open, and a server that limits PINGs
(grpc-go answers a client that pings more often than every 5 minutes
with GOAWAY) refuses a short interval. Set it to what the path allows.
http2_keep_alive_timeout: DurationHow long to wait for the answer to such a PING before the connection
is dropped. Used only with
http2_keep_alive_interval.
Default: 20 seconds.
bare_address_scheme: GrpcBareAddressSchemeHow a bare host[:port] address is connected. See
GrpcBareAddressScheme.
tls_config: Option<ClientTlsConfig>grpc-tls only.TLS settings for https:// endpoints (explicit or derived from a bare
address). None verifies the server against the bundled Mozilla root
store (webpki-roots), which is what a public agent needs; set one to
pin a private CA or a client certificate.
Implementations§
Source§impl GrpcTransportConfig
impl GrpcTransportConfig
Sourcepub const fn with_http2_keep_alive(
self,
interval: Duration,
timeout: Duration,
) -> GrpcTransportConfig
pub const fn with_http2_keep_alive( self, interval: Duration, timeout: Duration, ) -> GrpcTransportConfig
Sends an HTTP/2 PING every interval and drops the connection if
none is answered within timeout (see
http2_keep_alive_interval).
Sourcepub const fn with_timeout(self, timeout: Duration) -> GrpcTransportConfig
pub const fn with_timeout(self, timeout: Duration) -> GrpcTransportConfig
Sets the unary request timeout.
Sourcepub const fn with_send_timeout(self, timeout: Duration) -> GrpcTransportConfig
pub const fn with_send_timeout(self, timeout: Duration) -> GrpcTransportConfig
Sets send_timeout.
Sourcepub const fn with_connect_timeout(
self,
timeout: Duration,
) -> GrpcTransportConfig
pub const fn with_connect_timeout( self, timeout: Duration, ) -> GrpcTransportConfig
Sets the connection timeout.
Sourcepub const fn with_max_message_size(self, size: usize) -> GrpcTransportConfig
pub const fn with_max_message_size(self, size: usize) -> GrpcTransportConfig
Sets the maximum inbound message size.
Sourcepub const fn with_stream_channel_capacity(
self,
capacity: usize,
) -> GrpcTransportConfig
pub const fn with_stream_channel_capacity( self, capacity: usize, ) -> GrpcTransportConfig
Sets the channel capacity for streaming responses.
Sourcepub const fn with_bare_address_scheme(
self,
scheme: GrpcBareAddressScheme,
) -> GrpcTransportConfig
pub const fn with_bare_address_scheme( self, scheme: GrpcBareAddressScheme, ) -> GrpcTransportConfig
Sets how a bare host[:port] address is connected.
Sourcepub fn with_tls_config(self, tls: ClientTlsConfig) -> GrpcTransportConfig
Available on crate feature grpc-tls only.
pub fn with_tls_config(self, tls: ClientTlsConfig) -> GrpcTransportConfig
grpc-tls only.Sets the TLS configuration used for https:// endpoints.
Trait Implementations§
Source§impl Clone for GrpcTransportConfig
impl Clone for GrpcTransportConfig
Source§fn clone(&self) -> GrpcTransportConfig
fn clone(&self) -> GrpcTransportConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GrpcTransportConfig
impl Debug for GrpcTransportConfig
Source§impl Default for GrpcTransportConfig
impl Default for GrpcTransportConfig
Source§fn default() -> GrpcTransportConfig
fn default() -> GrpcTransportConfig
Auto Trait Implementations§
impl Forget for GrpcTransportConfig
impl Freeze for GrpcTransportConfig
impl Move for GrpcTransportConfig
impl RefUnwindSafe for GrpcTransportConfig
impl Send for GrpcTransportConfig
impl Sync for GrpcTransportConfig
impl Unpin for GrpcTransportConfig
impl UnsafeUnpin for GrpcTransportConfig
impl UnwindSafe for GrpcTransportConfig
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].