#[non_exhaustive]pub struct GrpcConfig {Show 20 fields
pub enabled: bool,
pub listener: Listener,
pub bind: String,
pub health: bool,
pub reflection: Toggle,
pub metrics: bool,
pub max_metric_series: usize,
pub shutdown_grace_ms: u64,
pub timeout_ms: u64,
pub max_connections: usize,
pub concurrency_limit_per_connection: usize,
pub max_concurrent_streams: u32,
pub http2_max_local_error_reset_streams: usize,
pub tcp_nodelay: bool,
pub tcp_keepalive_ms: u64,
pub http2_keepalive_interval_ms: u64,
pub http2_keepalive_timeout_ms: u64,
pub max_connection_age_ms: u64,
pub tls: TlsConfig,
pub clients: BTreeMap<String, ClientConfig>,
}Expand description
Settings for one gRPC server.
The defaults limit resource use. For a setting that says “0: off”,
the value 0 removes that limit or feature.
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.enabled: boolStart the server. Default: true.
listener: Listenerdedicated: a listener of its own, on bind. shared: Autumn’s
HTTP port (needs the multiplex feature). Default: dedicated.
bind: StringListen address, IP:port. Port 0 picks a free port. Empty: the
profile decides. dev and test use 127.0.0.1:50051. Other
profiles use 0.0.0.0:50051. Default: empty.
health: boolServe grpc.health.v1.Health. Default: true.
reflection: ToggleServe server reflection. auto is on in dev and test only.
metrics: boolRecord grpc_server_* metrics. Default: true.
max_metric_series: usizeMaximum label sets per metric. The plugin counts new label sets
over this limit as other. Default: 1000.
shutdown_grace_ms: u64Time for in-flight calls to finish at shutdown. Must be more than
0. Default: 10000.
timeout_ms: u64Per-call timeout for unary calls. 0: off. Default: 0.
max_connections: usizeOpen connections. The listener waits when it reaches the limit.
0: off. Default: 1000.
concurrency_limit_per_connection: usizeConcurrent calls per connection. A streaming call counts until its
response starts. 0: off. Default: 0.
max_concurrent_streams: u32HTTP/2 SETTINGS_MAX_CONCURRENT_STREAMS. Must be more than 0.
Default: 200.
http2_max_local_error_reset_streams: usizeServer-side stream resets per connection before the server closes
it (a protection against reset floods). Must be more than 0.
Default: 1024.
tcp_nodelay: boolSet TCP_NODELAY. Default: true.
tcp_keepalive_ms: u64TCP keepalive idle time. 0: off. Default: 0.
http2_keepalive_interval_ms: u64HTTP/2 PING interval. 0: off. Default: 60000.
http2_keepalive_timeout_ms: u64Time to wait for a PING reply. 0: tonic default (20 s).
Default: 20000.
max_connection_age_ms: u64Close connections after this age. 0: off. Default: 0.
tls: TlsConfigTLS settings. Empty paths mean plain text.
clients: BTreeMap<String, ClientConfig>Downstream services to call, by name ([grpc.clients.<name>]).
Needs the client feature. The server does not use them.
Implementations§
Source§impl GrpcConfig
impl GrpcConfig
Sourcepub fn bind_addr(&self, development: bool) -> Result<SocketAddr, ConfigError>
pub fn bind_addr(&self, development: bool) -> Result<SocketAddr, ConfigError>
The listen address. An empty bind gives 127.0.0.1:50051 in
development and 0.0.0.0:50051 in other profiles.
§Errors
Returns ConfigError when bind is not IP:port.
Sourcepub const fn shutdown_grace(&self) -> Duration
pub const fn shutdown_grace(&self) -> Duration
Shutdown grace period.
Sourcepub const fn tcp_keepalive(&self) -> Option<Duration>
pub const fn tcp_keepalive(&self) -> Option<Duration>
TCP keepalive idle time.
Sourcepub const fn http2_keepalive_interval(&self) -> Option<Duration>
pub const fn http2_keepalive_interval(&self) -> Option<Duration>
HTTP/2 PING interval.
Sourcepub const fn http2_keepalive_timeout(&self) -> Option<Duration>
pub const fn http2_keepalive_timeout(&self) -> Option<Duration>
HTTP/2 PING ack timeout.
Sourcepub const fn max_connection_age(&self) -> Option<Duration>
pub const fn max_connection_age(&self) -> Option<Duration>
Maximum connection age.
Sourcepub fn from_toml_str(text: &str, section: &str) -> Result<Self, ConfigError>
pub fn from_toml_str(text: &str, section: &str) -> Result<Self, ConfigError>
Parse [section] from a whole autumn.toml text. No profiles and
no environment.
§Errors
Returns ConfigError for bad TOML, unknown keys, wrong types or
values that validate rejects.
Sourcepub fn resolve(section: &str) -> Result<Resolved, ConfigError>
pub fn resolve(section: &str) -> Result<Resolved, ConfigError>
Resolve [section] from the app’s files and the process environment.
§Errors
Returns ConfigError when a file cannot be read or parsed, or when
the merged section is not valid.
Sourcepub fn resolve_with_env(
section: &str,
env: &dyn Env,
) -> Result<Resolved, ConfigError>
pub fn resolve_with_env( section: &str, env: &dyn Env, ) -> Result<Resolved, ConfigError>
Sourcepub fn resolve_with_env_and_clients(
section: &str,
env: &dyn Env,
clients: &[&str],
) -> Result<Resolved, ConfigError>
pub fn resolve_with_env_and_clients( section: &str, env: &dyn Env, clients: &[&str], ) -> Result<Resolved, ConfigError>
Like resolve_with_env. Env overrides
apply to each client in the files and to each name in clients
(the plugin passes the names from client).
§Errors
See resolve.
Sourcepub fn validate(&self) -> Result<(), ConfigError>
pub fn validate(&self) -> Result<(), ConfigError>
Trait Implementations§
Source§impl Clone for GrpcConfig
impl Clone for GrpcConfig
Source§impl Debug for GrpcConfig
impl Debug for GrpcConfig
Source§impl Default for GrpcConfig
impl Default for GrpcConfig
Source§impl<'de> Deserialize<'de> for GrpcConfigwhere
GrpcConfig: Default,
impl<'de> Deserialize<'de> for GrpcConfigwhere
GrpcConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for GrpcConfig
Source§impl PartialEq for GrpcConfig
impl PartialEq for GrpcConfig
Source§impl Serialize for GrpcConfig
impl Serialize for GrpcConfig
impl StructuralPartialEq for GrpcConfig
Auto Trait Implementations§
impl Forget for GrpcConfig
impl Freeze for GrpcConfig
impl RefUnwindSafe for GrpcConfig
impl Send for GrpcConfig
impl Sync for GrpcConfig
impl Unpin for GrpcConfig
impl UnsafeUnpin for GrpcConfig
impl UnwindSafe for GrpcConfig
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
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> 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::Requestimpl<T> JsonSink for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Scoped for T
impl<T> Scoped for T
Source§fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
ScopeQuery for this type. Resolves the
registered scope at .load() time, not here.