Skip to main content

Eligibility

Struct Eligibility 

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

宿主提供的本地业务资格,不应由包含远端注册结果的整体 readiness 反向驱动。

Implementations§

Source§

impl Eligibility

Source

pub fn new() -> Self

业务作用:创建默认不接流的资格源,监听器准备后再显式开放。 参数说明:无。 返回:可由宿主保留的资格控制句柄。

Source

pub fn channel() -> (EligibilityController, Self)

业务作用:为手动宿主分离资格更新责任与传入 owner 的只读信号。 参数说明:无。 返回:唯一发送者和默认不接流的信号,发送者退出或证据过期均撤权。

Source

pub fn set(&self, ready: bool)

业务作用:同步改变本地发布资格,与注册提交前复验使用同一把锁。 参数说明:ready 表示该注册对应的本地 listener 和业务依赖是否可接流。 返回:后续发布立即受约束;手动 true 最多有效三十秒,需要宿主持续更新。

Source

pub fn is_ready(&self) -> bool

业务作用:读取本地资格供独立健康端点返回真实状态。 参数说明:无。 返回:本地事实,不包含注册中心回查结果。

Source

pub fn from_check(check: impl Fn() -> bool + Send + Sync + 'static) -> Self

业务作用:绑定宿主可同步读取的本地资格,在实际发布点重新读取而不依赖轮询延迟。 参数说明:check 必须无网络、有限时间返回,且不得重入 discovery 或改变资格对象。 返回:只依赖宿主当前事实的资格源;闭包必须自行包含停机和证据期限门禁。

Trait Implementations§

Source§

impl Clone for Eligibility

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 Default for Eligibility

Source§

fn default() -> Self

业务作用:默认关闭发布许可,避免构造组件即对外注册。 参数说明:无。 返回:未就绪的本地资格源。

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.