pub struct ConnectionConfig {Show 13 fields
pub provider: String,
pub startup_required: bool,
pub request_timeout_ms: u64,
pub poll_interval_ms: u64,
pub idle_timeout_ms: u64,
pub snapshot: SnapshotPolicy,
pub retry: RetryPolicy,
pub nacos: Option<Value>,
pub consul: Option<Value>,
pub kubernetes: Option<Value>,
pub static_config: Option<StaticConfig>,
pub dns: Option<DnsConfig>,
pub rest: Option<RestPolicy>,
}Expand description
单个 qualifier 的后端配置;provider 必须与唯一的后端配置块一致。
Fields§
§provider: String后端类型或实例,决定该连接支持的发现及注册能力。
startup_required: bool是否要求启动阶段确认成功;失败时阻止宿主完成启动。
request_timeout_ms: u64一次请求的最大耗时,单位为毫秒。
poll_interval_ms: u64后台轮询间隔,单位为毫秒,必须留出请求和证据时效预算。
idle_timeout_ms: u64无人使用的服务观察保留时长,单位为毫秒。
snapshot: SnapshotPolicy共享发现证据的年龄上限与异常宽限。
retry: RetryPolicy连接准备失败时的重试退避预算。
nacos: Option<Value>Nacos 专用配置,只有 Nacos 后端可以使用。
consul: Option<Value>Consul 专用配置,只有 Consul 后端可以使用。
kubernetes: Option<Value>Kubernetes 只读发现配置,不授予 Service 或 EndpointSlice 写入权。
static_config: Option<StaticConfig>静态实例映射;配置文件中的键为 static。
dns: Option<DnsConfig>DNS 服务映射,不支持服务注册。
rest: Option<RestPolicy>该连接的 REST 调用策略,与其他 qualifier 的调用预算隔离。
Implementations§
Source§impl ConnectionConfig
impl ConnectionConfig
Sourcepub fn has_service(&self, service: &str) -> bool
pub fn has_service(&self, service: &str) -> bool
业务作用:在网络准备之前核对宿主引用是否属于该连接的显式服务目录。
参数说明:
service:是本地服务别名,不能替代后端服务名或跨连接查询。
返回:静态、DNS 或已配置 provider 服务表包含该精确别名时为 true。
Sourcepub fn policy(&self) -> ConnectionPolicy
pub fn policy(&self) -> ConnectionPolicy
业务作用:把公开配置转换为 owner 的冻结时效预算。
参数说明:无。
返回:不依赖具体传输默认值的公共策略。
Trait Implementations§
Source§impl Clone for ConnectionConfig
impl Clone for ConnectionConfig
Source§impl Default for ConnectionConfig
impl Default for ConnectionConfig
Source§impl<'de> Deserialize<'de> for ConnectionConfigwhere
ConnectionConfig: Default,
impl<'de> Deserialize<'de> for ConnectionConfigwhere
ConnectionConfig: 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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Forget for ConnectionConfig
impl Freeze for ConnectionConfig
impl Move for ConnectionConfig
impl RefUnwindSafe for ConnectionConfig
impl Send for ConnectionConfig
impl Sync for ConnectionConfig
impl Unpin for ConnectionConfig
impl UnsafeUnpin for ConnectionConfig
impl UnwindSafe for ConnectionConfig
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
Mutably borrows from an owned value. Read more