Trait abstract_ns::HostSubscribe
[−]
[src]
pub trait HostSubscribe { type HostError: Into<Error>; type HostStream: Stream<Item = IpList, Error = Self::HostError>; fn subscribe_host(&self, name: &Name) -> Self::HostStream; }
A resolver that allows to subscribe on the host name and receive updates
Associated Types
type HostError: Into<Error>
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).
type HostStream: Stream<Item = IpList, Error = Self::HostError>
A stream returned from subscribe()
Required Methods
fn subscribe_host(&self, name: &Name) -> Self::HostStream
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: HostSubscribe> HostSubscribe for Arc<T>
[src]
type HostError = T::HostError
type HostStream = T::HostStream
fn subscribe_host(&self, name: &Name) -> Self::HostStream
[src]
Implementors
impl<R: HostResolve> HostSubscribe for FrozenSubscriber<R> type HostStream = StreamOnce<R::HostFuture>; type HostError = <R::HostFuture as Future>::Error;