[][src]Struct netidx::subscriber::Dval

pub struct Dval(_);

Dval is a durable value subscription. it behaves just like Val, except that if it dies a task within subscriber will attempt to resubscribe. The resubscription process goes through the entire resolution and connection process again, so Dval is robust to many failures. For example,

  • multiple publishers are publishing on a path and one of them dies. Dval will transparently move to another one.

  • a publisher is restarted (possibly on a different machine). Dval will wait using linear backoff for the publisher to come back, and then it will resubscribe.

  • The resolver server cluster is restarted. In this case existing subscriptions won't die, but new ones will fail while the cluster is down. However once it is back up, and the publishers have republished all their data, which they will do automatically, Dval will resubscribe to anything it couldn't find while the resolver server cluster was down.

A Dval uses a bit more memory than a Val subscription, but other than that the performance is the same. It is therefore recommended that you use Dval as the default kind of value subscription.

If all user held references to Dval are dropped it will be unsubscribed.

Implementations

impl Dval[src]

pub async fn last<'_>(&'_ self) -> Option<Value>[src]

Get the last value published by the publisher, or None if the subscription is currently dead.

pub fn state_updates(
    &self,
    include_current: bool,
    tx: UnboundedSender<(SubId, DvState)>
)
[src]

Register tx to receive messages about subscription state changes of this Dval. You can register multiple channels to receive state updates, and you can register one channel to receive updates about multiple Dvals.

pub fn state(&self) -> DvState[src]

return the current subscription state

pub fn updates(&self, begin_with_last: bool, tx: Sender<Batch>)[src]

Register tx to receive updates to this Dval. If begin_with_last is true, then an immediate update will be sent consisting of the last value received from the publisher.

You may register multiple different channels to receive updates from a Dval, and you may register one channel to receive updates from multiple Dvals.

pub fn write(&self, v: Value) -> bool[src]

Write a value back to the publisher, see Val::write. If we aren't currently connected the write will be dropped and this method will return false

pub fn id(&self) -> SubId[src]

return the unique id of this Dval

Trait Implementations

impl Clone for Dval[src]

impl Debug for Dval[src]

Auto Trait Implementations

impl !RefUnwindSafe for Dval

impl Send for Dval

impl Sync for Dval

impl Unpin for Dval

impl !UnwindSafe for Dval

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,