Skip to main content

LocalProvider

Struct LocalProvider 

Source
pub struct LocalProvider { /* private fields */ }
Expand description

静态实例或 DNS 地址的只读适配器,不提供注册中心健康证据或写入能力。

Implementations§

Source§

impl LocalProvider

Source

pub fn static_services( services: BTreeMap<String, Vec<Instance>>, ) -> Result<Self>

业务作用:冻结普通服务的静态实例表,不产生自注册副作用。

参数说明:

  • services:为服务到完整实例列表的显式映射。

返回:合法静态表对应的只读 provider。

Source

pub fn dns_services(services: BTreeMap<String, DnsService>) -> Result<Self>

业务作用:复用 A/AAAA 地址解析,只允许显式服务绑定。

参数说明:

  • services:为服务别名与主机端口映射。

返回:只读 DNS provider,不承诺 SRV、DNS TTL 或业务健康。

Trait Implementations§

Source§

impl ManagedProvider for LocalProvider

Source§

fn capabilities(&self) -> Capabilities

业务作用:准确声明本地后端只读与证据边界。

参数说明:无。

返回:Static 或 Address 证据,永不声明远端健康。

Source§

fn prepare<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

业务作用:确认本地配置 provider 仍开放。

参数说明:无。

返回:不把 DNS 配置有效误报为远端服务健康。

Source§

fn observe<'life0, 'life1, 'async_trait>( &'life0 self, service: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ProviderSnapshot>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

业务作用:读取完整静态表或执行一次 DNS 地址解析。

参数说明:

  • service:是显式服务别名。

返回:完整候选或地址解析失败,不使用旧 DNS 缓存伪造新证据。

Source§

fn services<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

业务作用:只枚举显式配置服务,不执行全局目录扫描。

参数说明:无。

返回:本连接配置的服务名。

Source§

fn close<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

业务作用:禁止该本地适配器接受新观察。

参数说明:无。

返回:重复关闭幂等,没有独立后台循环。

Source§

fn change_wait_timeout(&self) -> Option<Duration>

业务作用:声明后端能否提供不占用短请求额度的变更等待。 Read more
Source§

fn change_wait_streams(&self) -> u32

业务作用:为一次变更等待预留实际可能并发的后端长请求额度。 Read more
Source§

fn wait_for_change<'life0, 'life1, 'async_trait>( &'life0 self, _service: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), DiscoveryError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

业务作用:等待服务或端点变化,调用方取消时释放当前长连接。 Read more
Source§

fn validate_registration( &self, _plan: &RegistrationPlan, ) -> Result<(), DiscoveryError>

业务作用:在外部写入前校验 provider 特定注册字段与所有权键。 Read more
Source§

fn registration_key(&self, plan: &RegistrationPlan) -> String

业务作用:计算可核对的远端注册键,用于同一 owner 内重复目标预检。 Read more
Source§

fn service_key(&self, service: &str) -> Result<String, DiscoveryError>

业务作用:识别不同本地别名是否读取相同的后端服务集合,供宿主核对发布投影一致性。 Read more
Source§

fn instance_key(&self, instance: &Instance) -> String

业务作用:保留同地址不同后端实例的身份,避免发现层按 IP/端口错误合并。 Read more
Source§

fn register<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _plan: &'life1 RegistrationPlan, _admission: &'life2 dyn WriteAdmission, ) -> Pin<Box<dyn Future<Output = Result<(), DiscoveryError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

业务作用:执行一次注册,不在方法外另起自动重放。 Read more
Source§

fn renew<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _plan: &'life1 RegistrationPlan, _ready: bool, _admission: &'life2 dyn WriteAdmission, ) -> Pin<Box<dyn Future<Output = Result<(), DiscoveryError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

业务作用:续约既有记录或上报本地健康,不覆盖管理端禁用属性。 Read more
Source§

fn renewal_interval(&self, _plan: &RegistrationPlan) -> Option<Duration>

业务作用:提供本后端需要的最大发送间隔。 Read more
Source§

fn supports_idempotent_renewal(&self, _plan: &RegistrationPlan) -> bool

业务作用:声明同一冻结身份与相同健康 payload 的续约能否在响应丢失后重复提交。 Read more
Source§

fn inspect<'life0, 'life1, 'async_trait>( &'life0 self, _plan: &'life1 RegistrationPlan, ) -> Pin<Box<dyn Future<Output = Result<RegistrationEvidence, DiscoveryError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

业务作用:核对本实例的在册及健康事实。 Read more
Source§

fn deregister<'life0, 'life1, 'async_trait>( &'life0 self, _plan: &'life1 RegistrationPlan, ) -> Pin<Box<dyn Future<Output = Result<(), DiscoveryError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

业务作用:删除当前计划的远端记录,不消费本地事实。 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> 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, 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.