mirror of https://github.com/linkerd/linkerd2.git
proxy: Document tls::config::watch_for_config_changes (#1176)
While investigating TLS configuration, I found myself wanting a docstring on `tls::config::watch_for_config_changes`. This has one minor change in functionality: now, `future::empty()` is returned instead of `future:ok(())` so that the task never completes. It seems that, ultimately, we'll want to treat it as an error if we lose the ability to receive configuration updates.
This commit is contained in:
parent
e80356de34
commit
5f7067c864
|
@ -249,15 +249,27 @@ impl CommonConfig {
|
|||
|
||||
}
|
||||
|
||||
// A Future that, when polled, checks for config updates and publishes them.
|
||||
pub type PublishConfigs = Box<Future<Item = (), Error = ()> + Send>;
|
||||
|
||||
/// Returns Client and Server config watches, and a task to drive updates.
|
||||
///
|
||||
/// The returned task Future is expected to never complete.
|
||||
///
|
||||
/// If there are no TLS settings, then empty watches are returned. In this case, the
|
||||
/// Future is never notified.
|
||||
///
|
||||
/// If all references are dropped to _either_ the client or server config watches, all
|
||||
/// updates will cease for both config watches.
|
||||
pub fn watch_for_config_changes(settings: Conditional<&CommonSettings, ReasonForNoTls>)
|
||||
-> (ClientConfigWatch, ServerConfigWatch, Box<Future<Item = (), Error = ()> + Send>)
|
||||
-> (ClientConfigWatch, ServerConfigWatch, PublishConfigs)
|
||||
{
|
||||
let settings = if let Conditional::Some(settings) = settings {
|
||||
settings.clone()
|
||||
} else {
|
||||
let (client_watch, _) = Watch::new(None);
|
||||
let (server_watch, _) = Watch::new(None);
|
||||
let no_future = future::ok(());
|
||||
let no_future = future::empty();
|
||||
return (client_watch, server_watch, Box::new(no_future));
|
||||
};
|
||||
|
||||
|
@ -282,8 +294,8 @@ pub fn watch_for_config_changes(settings: Conditional<&CommonSettings, ReasonFor
|
|||
Ok((client_store, server_store))
|
||||
})
|
||||
.then(|_| {
|
||||
trace!("forwarding to server config watch finished.");
|
||||
Ok(())
|
||||
error!("forwarding to tls config watches finished.");
|
||||
Err(())
|
||||
});
|
||||
|
||||
// This function and `ServerConfig::no_tls` return `Box<Future<...>>`
|
||||
|
|
Loading…
Reference in New Issue