pub trait ManagedProvider:
Send
+ Sync
+ 'static {
Show 18 methods
// Required methods
fn capabilities(&self) -> Capabilities;
fn prepare<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), DiscoveryError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn observe<'life0, 'life1, 'async_trait>(
&'life0 self,
service: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ProviderSnapshot, DiscoveryError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), DiscoveryError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
// Provided methods
fn change_wait_timeout(&self) -> Option<Duration> { ... }
fn change_wait_streams(&self) -> u32 { ... }
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 { ... }
fn services<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DiscoveryError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait { ... }
fn validate_registration(
&self,
_plan: &RegistrationPlan,
) -> Result<(), DiscoveryError> { ... }
fn registration_key(&self, plan: &RegistrationPlan) -> String { ... }
fn service_key(&self, service: &str) -> Result<String, DiscoveryError> { ... }
fn instance_key(&self, instance: &Instance) -> String { ... }
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 { ... }
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 { ... }
fn renewal_interval(&self, _plan: &RegistrationPlan) -> Option<Duration> { ... }
fn supports_idempotent_renewal(&self, _plan: &RegistrationPlan) -> bool { ... }
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 { ... }
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 { ... }
}Expand description
每个方法代表一次有界操作,调用者拥有 deadline、取消、续约与恢复策略。
Required Methods§
Sourcefn capabilities(&self) -> Capabilities
fn capabilities(&self) -> Capabilities
业务作用:报告此适配器的能力边界。 参数说明:无。 返回:静态、解析和后端健康证据不互相冒充。
Sourcefn prepare<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), DiscoveryError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn prepare<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), DiscoveryError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
业务作用:在声明的服务作用域内确认出站能力,不要求目标已有实例。 参数说明:无。 返回:认证或作用域访问失败时拒绝连接可用状态。
Sourcefn observe<'life0, 'life1, 'async_trait>(
&'life0 self,
service: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ProviderSnapshot, DiscoveryError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn observe<'life0, 'life1, 'async_trait>(
&'life0 self,
service: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ProviderSnapshot, DiscoveryError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
业务作用:取得某个受信服务目标的完整实例事实。
参数说明:service 为连接内服务名或显式绑定别名。
返回:完整空集合表示无实例;截断、撤权和网络异常返回错误。
Provided Methods§
Sourcefn change_wait_timeout(&self) -> Option<Duration>
fn change_wait_timeout(&self) -> Option<Duration>
业务作用:声明后端能否提供不占用短请求额度的变更等待。 参数说明:无。 返回:最大等待时间;通知仅触发完整重读,不构成健康证据。
Sourcefn change_wait_streams(&self) -> u32
fn change_wait_streams(&self) -> u32
业务作用:为一次变更等待预留实际可能并发的后端长请求额度。 参数说明:无。 返回:默认一个请求;同时观察多类资源的 provider 必须报告合计上限。
Sourcefn 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,
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,
业务作用:等待服务或端点变化,调用方取消时释放当前长连接。
参数说明:service 与最近一次完整观察使用同一作用域。
返回:变化时重新全量观察;同步丢失时明确失败。
Sourcefn services<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DiscoveryError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn services<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DiscoveryError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
业务作用:枚举当前连接允许的服务范围。 参数说明:无。 返回:没有枚举能力时明确拒绝,不申请更大作用域。
Sourcefn validate_registration(
&self,
_plan: &RegistrationPlan,
) -> Result<(), DiscoveryError>
fn validate_registration( &self, _plan: &RegistrationPlan, ) -> Result<(), DiscoveryError>
业务作用:在外部写入前校验 provider 特定注册字段与所有权键。
参数说明:plan 是不可变注册计划。
返回:读侧 provider 或不支持的字段必须拒绝。
Sourcefn registration_key(&self, plan: &RegistrationPlan) -> String
fn registration_key(&self, plan: &RegistrationPlan) -> String
业务作用:计算可核对的远端注册键,用于同一 owner 内重复目标预检。
参数说明:plan 是已校验注册计划。
返回:包含真实后端作用域的键;不把配置连接别名当作远端身份。
Sourcefn service_key(&self, service: &str) -> Result<String, DiscoveryError>
fn service_key(&self, service: &str) -> Result<String, DiscoveryError>
业务作用:识别不同本地别名是否读取相同的后端服务集合,供宿主核对发布投影一致性。
参数说明:service 是已绑定的服务别名。
返回:不含凭据的后端查询键;有实际作用域的 adapter 必须包含地址、命名空间和过滤条件。
Sourcefn instance_key(&self, instance: &Instance) -> String
fn instance_key(&self, instance: &Instance) -> String
业务作用:保留同地址不同后端实例的身份,避免发现层按 IP/端口错误合并。
参数说明:instance 来自本 provider 的完整观察。
返回:当前服务作用域内的稳定非空键;后端有实例 ID 时应覆盖此默认地址键。
Sourcefn 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,
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,
业务作用:执行一次注册,不在方法外另起自动重放。
参数说明:plan 保留本次实例身份与端点,admission 必须用于实际传输提交。
返回:远端接纳或明确错误,传输结果不明由 owner 保留待核对记录。
Sourcefn 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,
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,
业务作用:续约既有记录或上报本地健康,不覆盖管理端禁用属性。
参数说明:plan 是既有注册,ready 是当前本地资格,admission 防止鉴权等待后继续发布。
返回:续约失败不能隐式变成重新注册。
Sourcefn renewal_interval(&self, _plan: &RegistrationPlan) -> Option<Duration>
fn renewal_interval(&self, _plan: &RegistrationPlan) -> Option<Duration>
业务作用:提供本后端需要的最大发送间隔。
参数说明:plan 指定检查模式与有效时限。
返回:无需主动保活时为空;否则 owner 按间隔监督。
Sourcefn supports_idempotent_renewal(&self, _plan: &RegistrationPlan) -> bool
fn supports_idempotent_renewal(&self, _plan: &RegistrationPlan) -> bool
业务作用:声明同一冻结身份与相同健康 payload 的续约能否在响应丢失后重复提交。
参数说明:plan 是已成功注册且尚未开始注销的固定计划。
返回:默认不允许;返回 true 的 provider 必须保证重复续约不重建身份、不覆盖管理属性,且不把它视为先前请求已停止执行的证明。
Sourcefn 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,
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,
业务作用:核对本实例的在册及健康事实。
参数说明:plan 决定精确注册身份。
返回:查询失败与缺失、禁用、不健康明确区分。
Sourcefn 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,
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,
业务作用:删除当前计划的远端记录,不消费本地事实。
参数说明:plan 用于确定注销目标。
返回:失败后 owner 仍能报告残留并安排同身份清理。
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".