Trait abstract_ns::Subscribe [] [src]

pub trait Subscribe {
    type Error: Into<Error>;
    type Stream: Stream<Item = Address, Error = Self::Error>;
    fn subscribe(&self, name: &Name) -> Self::Stream;
}

A resolver that allows to subscribe on the service name and receive updates

Associated Types

An error type returned by a stream

This is usually either abstract_ns::Error or Void, showing whether error can actually occur, but can be any other error at your convenience.

Note: this is an associated type so that connection pool implementations could accept SubscribeHost<Error=Void> as there are no reason to shutdown pool if there is a temporary error in name resolution (and all errors should be considered temporary as user can even fix invalid name by fixing configuration file while connection pool is operating).

A stream returned from subscribe()

Required Methods

Resolve a name and subscribe to the updates

Note: errors returned by a stream are considered fatal but temporary. I.e. stream can't be used after an error, but user might subscribe again after a short interval.

For efficiency it might be useful to attempt name resolution few times if the error is temporary before returning an error, but on network resolver fatal errors (or subsequent temporary ones) should be returned so middleware and routers can failover to other sources and put errors to log.

Implementations on Foreign Types

impl<T: Subscribe> Subscribe for Arc<T>
[src]

[src]

Implementors