Skip to main content

DiscoveryHandle

Struct DiscoveryHandle 

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

只有观察权的具名连接句柄,不能关闭其他消费者使用的连接。

Implementations§

Source§

impl DiscoveryHandle

Source

pub async fn observe( &self, service: &str, deadline: Instant, ) -> Result<Observation>

业务作用:取得连接内服务的共享观察,首个等待者取消不影响其他需求。

参数说明:

  • service:是后端名或明确绑定别名
  • deadline:是调用方总期限。

返回:总期限内取得共享证据后返回凭据;过期调用不取得缓存或创建需求,失败、容量不足和关闭返回错误。

Source

pub fn name(&self) -> &str

业务作用:显示连接的精确名称,避免跨环境猜测默认目标。

参数说明:无。

返回:构造时冻结的连接名。

Source§

impl DiscoveryHandle

Source

pub fn reserve_transport(&self) -> Result<TransportLease>

业务作用:在打开传输前预留 owner 级有限容量,关闭和容量不足时不启动连接。

参数说明:无。

返回:一次连接或正文任务的额度;释放后可由其他调用复用。

Trait Implementations§

Source§

impl Clone for DiscoveryHandle

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 DiscoveryClient for DiscoveryHandle

Source§

fn requires_admission(&self) -> bool

业务作用:要求兼容调用方逐次检查发送许可。

参数说明:无。

返回:受管连接始终需要提交门禁。

Source§

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,

业务作用:列出当前连接明确允许枚举的服务。

参数说明:无。

返回:不支持枚举时失败,不扩大后端权限范围。

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,

业务作用:为兼容调用方返回仍有效的可接流实例。

参数说明:

  • 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,

业务作用:通过共享观察提供完整实例,不另起每请求轮询。

参数说明:

  • 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,

业务作用:桥接旧 Vec watch,在失效时关闭 channel 而非伪造成功空集合。

参数说明:

  • service:是目标
  • options:不得要求快于冻结观察周期的校正。

返回:共享观察的兼容订阅,guard 释放即停止桥接任务。

Source§

fn watch<'life0, 'life1, 'async_trait>( &'life0 self, service: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ServiceWatch, Error>> + 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> 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> 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.