Skip to main content

Observation

Struct Observation 

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

服务观察凭据。变更通知可合并,当前有效性始终从固定状态槽重新读取。

Implementations§

Source§

impl Observation

Source

pub fn snapshot(&self, strict: bool) -> Result<Snapshot>

业务作用:按当前资格读取完整快照,严格调用可拒绝任何最近一次查询错误。 参数说明:strict 为 true 时不接受异常宽限。 返回:有效证据快照;关闭、超龄或撤权不返回旧路由。

Source

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

业务作用:等待证据变化或有效期结束,避免无变化时永久保留旧值。 参数说明:deadline 是本次等待上限。 返回:收到通知或真实证据期限到达时成功,调用方须重新读取 snapshot;关闭或仅调用方等待超时返回错误,静态证据没有到期期限。

Source

pub fn submit_if_current<T>( &self, instance: &Instance, submit: impl FnOnce() -> T, ) -> Result<T>

业务作用:在撤权共用的同步保护范围内提交一次传输。 参数说明:instance 必须仍是当前健康实例;submit 不得阻塞或重入发现接口。 返回:资格仍成立时执行回调;否则不提交。

Source

pub fn submit_if_current_strict<T>( &self, instance: &Instance, submit: impl FnOnce() -> T, ) -> Result<T>

业务作用:在强一致业务提交处同时拒绝最新查询失败和候选撤销,不使用异常宽限。 参数说明:instance 是此前选中的完整实例,submit 是不阻塞且不重入的同步提交。 返回:当前完整证据允许该候选才执行动作。

Trait Implementations§

Source§

impl Clone for Observation

Source§

fn clone(&self) -> Self

业务作用:增加当前目标的观察需求,共享已有后端查询。 参数说明:无。 返回:独立通知游标,不启动第二个轮询。

1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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.