pub struct DiscoveryHandle { /* private fields */ }Expand description
只有观察权的具名连接句柄,不能关闭其他消费者使用的连接。
Implementations§
Source§impl DiscoveryHandle
impl DiscoveryHandle
Source§impl DiscoveryHandle
impl DiscoveryHandle
Sourcepub fn reserve_transport(&self) -> Result<TransportLease>
pub fn reserve_transport(&self) -> Result<TransportLease>
业务作用:在打开传输前预留 owner 级有限容量,关闭和容量不足时不启动连接。
参数说明:无。
返回:一次连接或正文任务的额度;释放后可由其他调用复用。
Trait Implementations§
Source§impl Clone for DiscoveryHandle
impl Clone for DiscoveryHandle
Source§impl DiscoveryClient for DiscoveryHandle
impl DiscoveryClient for DiscoveryHandle
Source§fn requires_admission(&self) -> bool
fn requires_admission(&self) -> bool
业务作用:要求兼容调用方逐次检查发送许可。
参数说明:无。
返回:受管连接始终需要提交门禁。
Source§fn submit_if_current(
&self,
service: &str,
instance: &Instance,
submit: &mut dyn FnMut(),
) -> Result<()>
fn submit_if_current( &self, service: &str, instance: &Instance, submit: &mut dyn FnMut(), ) -> Result<()>
业务作用:使旧发现接口的发送路径服从统一观察门禁。
参数说明:
service:需要在当前连接已登记 slot 中查找的服务名。instance:本次发送绑定的完整候选实例。submit:只有候选仍有效时才同步调用的提交动作。
返回:服务 slot 存在且观察门禁允许候选时同步执行 submit,门禁或 slot 缺失返回错误;不把取得观察句柄视为持续有效的发送权。
Source§fn list_services<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_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 discover<'life0, 'life1, 'async_trait>(
&'life0 self,
service: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Instance>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn discover<'life0, 'life1, 'async_trait>(
&'life0 self,
service: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Instance>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
业务作用:为兼容调用方返回仍有效的可接流实例。
参数说明:
service:是明确服务目标。
返回:过滤后的业务自有数组;后续提交仍须复验。
Source§fn discover_all<'life0, 'life1, 'async_trait>(
&'life0 self,
service: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Instance>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn discover_all<'life0, 'life1, 'async_trait>(
&'life0 self,
service: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Instance>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
业务作用:通过共享观察提供完整实例,不另起每请求轮询。
参数说明:
service:是明确服务目标。
返回:有效完整快照的副本,副本不计入受管快照配额。
Source§fn watch_with_options<'life0, 'life1, 'async_trait>(
&'life0 self,
service: &'life1 str,
options: WatchOptions,
) -> Pin<Box<dyn Future<Output = Result<ServiceWatch>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn watch_with_options<'life0, 'life1, 'async_trait>(
&'life0 self,
service: &'life1 str,
options: WatchOptions,
) -> Pin<Box<dyn Future<Output = Result<ServiceWatch>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
业务作用:桥接旧 Vec watch,在失效时关闭 channel 而非伪造成功空集合。
参数说明:
service:是目标options:不得要求快于冻结观察周期的校正。
返回:共享观察的兼容订阅,guard 释放即停止桥接任务。
Auto Trait Implementations§
impl !RefUnwindSafe for DiscoveryHandle
impl !UnwindSafe for DiscoveryHandle
impl Forget for DiscoveryHandle
impl Freeze for DiscoveryHandle
impl Move for DiscoveryHandle
impl Send for DiscoveryHandle
impl Sync for DiscoveryHandle
impl Unpin for DiscoveryHandle
impl UnsafeUnpin for DiscoveryHandle
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