1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
#![doc(html_root_url = "https://docs.rs/tower-discover/0.1.0")] #![deny(rust_2018_idioms)] #![allow(elided_lifetimes_in_paths)] //! # Tower service discovery //! //! Service discovery is the automatic detection of services available to the //! consumer. These services typically live on other servers and are accessible //! via the network; however, it is possible to discover services available in //! other processes or even in process. mod error; mod list; mod stream; pub use crate::{list::ServiceList, stream::ServiceStream}; use futures::Poll; use std::hash::Hash; /// Provide a uniform set of services able to satisfy a request. /// /// This set of services may be updated over time. On each change to the set, a /// new `NewServiceSet` is yielded by `Discover`. /// /// See crate documentation for more details. pub trait Discover { /// NewService key type Key: Hash + Eq; type Service; /// Error produced during discovery type Error; /// Yields the next discovery change set. fn poll(&mut self) -> Poll<Change<Self::Key, Self::Service>, Self::Error>; } /// A change in the service set pub enum Change<K, V> { Insert(K, V), Remove(K), }