Skip to main content

DiscoveryOwner

Struct DiscoveryOwner 

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

非 Clone 的控制对象;查询句柄和等待凭据不继承关闭权。

Implementations§

Source§

impl DiscoveryOwner

Source

pub async fn prepare(&self, deadline: Instant) -> Result<()>

业务作用:启动独立连接监督并等待必需连接达到所需作用域的访问条件。

参数说明:

  • deadline:是宿主原启动截止点,取消等待不会丢失后台资源归属。

返回:必需连接准备成功;关闭或期限耗尽返回错误。

Source

pub fn client(&self, qualifier: Option<&str>) -> Result<DiscoveryHandle>

业务作用:取得精确连接或默认 primary,不跨环境回退。

参数说明:

  • qualifier:为空时采用 primary;兼容宿主显式设置的默认引用优先。

返回:只有查询权的句柄;不存在或已关闭时失败。

Source

pub fn freeze_registrations(&self, specs: Vec<RegistrationSpec>) -> Result<()>

业务作用:一次性校验并冻结全部最终注册计划,避免部分发布后才发现引用非法。

参数说明:

  • specs:已解析实际 listener、对外端点和本地资格来源。

返回:全部计划合法时原子登记,任何错误均不发出注册请求。

Source

pub async fn publish(&self, deadline: Instant) -> Result<()>

业务作用:在宿主监听器可接流后启动注册监督,等待启动必需目标的真实确认。

参数说明:

  • deadline:延续原启动期限,不为注册重新计时。

返回:全部启动必需注册确认后进入 Serving;失败由宿主发起有界清理。

Source

pub fn begin_quiesce(&self, deadline: Instant) -> QuiesceTicket

业务作用:同步撤销所有新注册和健康上报许可,保留出站发现供业务排空。

参数说明:

  • deadline:是摘流、业务排空与最终关闭共享的停机截止点。

返回:重复调用等待同一摘流结果;出站资源保留到 begin_close。

Source

pub fn begin_close(&self, deadline: Instant) -> CloseTicket

业务作用:发起唯一有界清理并同步撤销后续出站发送,等待取消不终止清理。

参数说明:

  • deadline:是宿主停机总截止点,首次调用后不能延长。

返回:可复制的只读关闭等待凭据。

Source

pub fn phase(&self) -> OwnerPhase

业务作用:读取当前 owner 阶段。

参数说明:无。

返回:单调推进的生命周期阶段。

Source

pub fn registrations(&self) -> Vec<RegistrationStatus>

业务作用:读取注册监督事实,供宿主映射就绪贡献和运维状态。

参数说明:无。

返回:按当前连接身份代次及本地资格裁决的状态;已撤权的注册不得继续贡献就绪,不输出凭据或 metadata。

Source

pub fn changes(&self) -> Receiver<u64>

业务作用:提供状态变化通知,允许宿主按同一事实监督而不复制后端轮询。

参数说明:无。

返回:只读通知流,收到通知后重新读取完整状态。

Source

pub fn observer(&self) -> RuntimeObserver

业务作用:向监控与运维代码提供没有关闭权的有界状态入口。

参数说明:无。

返回:观察器不延长 owner 的生命周期,也不创建后端任务。

Source

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

业务作用:在冻结发布计划前让宿主比较后端查询作用域,防止别名掩盖协议投影冲突。

参数说明:

  • connection:当前 owner 目录中的连接名。
  • service:交给该 provider 校验和投影的服务查询名。

返回:连接存在时原样返回 provider 的查询键或验证错误,未知连接时报错;本方法不独立检查服务是否在冻结目录中,不产生网络请求。

Trait Implementations§

Source§

impl Drop for DiscoveryOwner

Source§

fn drop(&mut self)

业务作用:控制对象丢弃时立即撤权,并在 Tokio 仍存在时触发有限清理。

参数说明:无。

返回:显式关闭以外的兜底不保证 runtime 退出后的网络清理。

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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.