Skip to main content

DiscoveryConfig

Struct DiscoveryConfig 

Source
pub struct DiscoveryConfig {
    pub enabled: bool,
    pub eligibility_probe: bool,
    pub default_connection: Option<String>,
    pub limits: Limits,
    pub connections: BTreeMap<String, ConnectionConfig>,
    pub registrations: BTreeMap<String, RegistrationConfig>,
}
Expand description

多注册中心连接、发布目标与资源预算;配置冻结后由同一 owner 管理生命周期。

Fields§

§enabled: bool

是否启用发现;禁用时不得同时声明连接、注册或资格探针。

§eligibility_probe: bool

是否启用宿主本地资格探针;不以远端注册结果反向驱动本地资格。

§default_connection: Option<String>

兼容显式默认引用;省略时只采用名为 primary 的连接,不按数量或顺序推断。

§limits: Limits

所有连接和发布目标共享的有限资源预算。

§connections: BTreeMap<String, ConnectionConfig>

以 qualifier 为键的连接目录,不按顺序推断默认连接。

§registrations: BTreeMap<String, RegistrationConfig>

注册目标集合,包含各目标独立的状态或发布策略。

Implementations§

Source§

impl DiscoveryConfig

Source

pub fn validate(&self) -> Result<()>

业务作用:校验所有引用与 provider 块,必需注册提升所属连接的启动要求。 参数说明:无。 返回:配置可用于独立宿主或 napp;禁用配置不产生后端连接,引用与 provider 拒绝携带字段路径。

Source

pub async fn build(&self) -> Result<DiscoveryOwner>

业务作用:构造各身份隔离的 provider 和公共 owner,不启动注册或网络轮询。 参数说明:无;配置值应已完成宿主占位符解析。 返回:唯一关闭 owner;只启用已编入的 provider。

Source

pub fn resolve( &self, listeners: &BTreeMap<String, ListenerEndpoint>, eligibility: &BTreeMap<String, Eligibility>, ) -> Result<Vec<RegistrationSpec>>

业务作用:在全部监听器已绑定后解析一次完整注册集合。 参数说明:listeners 是实际端点,eligibility 是宿主本地资格源;单项时允许省略对应引用。 返回:全部可解析的计划;不执行外部注册,不生成业务专用 metadata。

Trait Implementations§

Source§

impl Clone for DiscoveryConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for DiscoveryConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for DiscoveryConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for DiscoveryConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.