pub struct Config { /* private fields */ }
Expand description
Configuration of the router
It has a builder interface. You can create a router from Arc<Config>
(made by Config::done
) or a stream of configs.
Implementations§
Source§impl Config
impl Config
Sourcepub fn restart_delay(&mut self, delay: Duration) -> &mut Self
pub fn restart_delay(&mut self, delay: Duration) -> &mut Self
Sets delay after which router will restart any subscription stream
This works both when stream yields end-of-stream and when stream has returned error. Default value is 100 milliseconds.
Sourcepub fn convergence_delay(&mut self, delay: Duration) -> &mut Self
pub fn convergence_delay(&mut self, delay: Duration) -> &mut Self
Sets delay used by subscribe_many
family of functions
The timeout is set when a new set of names arrives via stream or when configuration is updated. While the timer is active we don’t send name updates to the application unless all (new) names are resolved.
Good value is bigger than 90 or 99 percentile of name request latency, but small enough that delay of this long doesn’t introduce any hiccups on the application.
For example, if there are names [A, B, C] if C is resolved first
we wait for the 100 millisecond (by default) timer to finish
to let A and B also be resolved. If they aren’t within the period
only names in C
are returned.
Note if names are reloved later, they are added to the address set and update is delivered to the client. I.e. it’s only important something depends on the first address value.
The case where it’s important is following: Client establishes few persistent connections by picking random IP Addresses from the set. Once new addresses arrive connections are still hold until one of them is broken. In this case, the first address (or the one that can be resolved faster for any reason) would have more connections received in most cases which might be a problem.
Sourcepub fn add_host<A>(&mut self, name: &Name, addr: A) -> &mut Self
pub fn add_host<A>(&mut self, name: &Name, addr: A) -> &mut Self
Add a host that will be resolved to list of addreses
Hosts added by this host method overrides any other resolvers.
Sourcepub fn add_service(&mut self, name: &Name, addr: Address) -> &mut Self
pub fn add_service(&mut self, name: &Name, addr: Address) -> &mut Self
Add a service that will be resolved to an Address object
Service names added by this host method overrides any other resolvers.
Sourcepub fn add_suffix<S, R>(&mut self, suffix: S, resolver: R) -> &mut Self
pub fn add_suffix<S, R>(&mut self, suffix: S, resolver: R) -> &mut Self
Add a resolver for suffix
Note: you must supply a full resolver here,
use null_resolver
/null_host_resolver
and
interval_subscribe
or frozen_subscriber
and other combinators to fullfill needed type.
Sourcepub fn remove_suffix<S>(&mut self, suffix: &str) -> &mut Self
pub fn remove_suffix<S>(&mut self, suffix: &str) -> &mut Self
Removes already configured suffix
Sourcepub fn set_fallthrough<R>(&mut self, resolver: R) -> &mut Self
pub fn set_fallthrough<R>(&mut self, resolver: R) -> &mut Self
Adds a host resolver used whenever no suffix matches