Struct netidx::subscriber::Subscriber[][src]

pub struct Subscriber(_);

create subscriptions

Implementations

impl Subscriber[src]

pub fn new(resolver: Config, desired_auth: Auth) -> Result<Subscriber>[src]

create a new subscriber with the specified config and desired auth

pub fn resolver(&self) -> ResolverRead[src]

pub async fn subscribe(
    &self,
    batch: impl IntoIterator<Item = Path>,
    timeout: Option<Duration>
) -> Vec<(Path, Result<Val>)>
[src]

Subscribe to the specified set of values.

To minimize round trips and amortize locking path resolution and subscription are done in batches. Best performance will be achieved with larger batches.

In case you are already subscribed to one or more of the paths in the batch, you will receive a reference to the existing subscription and no additional messages will be sent. However subscriber does not retain strong references to subscribed values, so if you drop all of them it will be unsubscribed.

It is safe to call this function concurrently with the same or overlapping sets of paths in the batch, only one subscription attempt will be made, and the result of that one attempt will be given to each concurrent caller upon success or failure.

The timeout, if specified, will apply to each subscription individually. Any subscription that does not complete successfully before the specified timeout will result in an error, but that error will not effect other subscriptions in the batch, which may complete successfully. If you need all or nothing behavior, specify None for timeout and wrap the subscribe future in a time::timeout.

pub async fn subscribe_one(
    &self,
    path: Path,
    timeout: Option<Duration>
) -> Result<Val>
[src]

Subscribe to just one value. This is sufficient for a small number of paths, but if you need to subscribe to a lot of values it is more efficent to use subscribe. The semantics of this method are the same as subscribe called with 1 path.

pub fn durable_subscribe(&self, path: Path) -> Dval[src]

Create a durable value subscription to path.

Batching of durable subscriptions is automatic, if you create a lot of durable subscriptions all at once they will batch.

The semantics of durable_subscribe are the same as subscribe, except that certain errors are caught, and resubscriptions are attempted. see Dval.

pub async fn flush(&self)[src]

This will return when all pending operations are flushed out to the publishers. This is primarially used to provide pushback in the case you want to do a lot of writes, and you need pushback in case a publisher is slow to process them, however it applies to durable_subscribe and unsubscribe as well.

Trait Implementations

impl Clone for Subscriber[src]

impl Debug for Subscriber[src]

Auto Trait Implementations

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> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

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