pub(super) fn spawn_discover(
        default: DefaultPolicy,
        idle_timeout: Duration,
        discover: api::Watch<S>,
        ports: HashSet<u16>,
    ) -> Self
    where
        S: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error>,
        S: Clone + Send + Sync + 'static,
        S::Future: Send,
        S::ResponseBody:
            http::HttpBody<Data = tonic::codegen::Bytes, Error = Error> + Default + Send + 'static,
    {
        // The initial set of policies never expire from the cache.
        //
        // Policies that are dynamically discovered at runtime will expire after
        // `idle_timeout` to prevent holding policy watches indefinitely for
        // ports that are generally unused.
        let cache = {
            let rxs = ports.into_iter().map(|port| {
                let discover = discover.clone();
                let default = default.clone();
                let rx = info_span!("watch", port)
                    .in_scope(|| discover.spawn_with_init(port, default.into()));
                (port, rx)
            });
            Cache::with_permanent_from_iter(idle_timeout, rxs)
        };

        Self {
            cache,
            discover: Some(discover),
            default_rx: Self::spawn_default(default),
        }
    }
/// Spawns a watch for each of the given ports.
///
/// A discovery watch is spawned for each of the described `ports` and the
/// result is cached for as long as the `Store` is held. The `Store` may be used to
Spawns a watch for each of the given ports.
A discovery watch is spawned for each of the described `ports` and the
result is cached for as long as the `Store` is held. The `Store` may be used to
Spawns a watch for each of the given ports . A discovery watch is spawned for each of the described ` ports ` and the result is cached for as long as the ` Store ` is held . The ` Store ` may be used to
pub(super) fn spawn_discover(
        default: DefaultPolicy,
        idle_timeout: Duration,
        discover: api::Watch<S>,
        ports: HashSet<u16>,
    ) -> Self
    where
        S: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error>,
        S: Clone + Send + Sync + 'static,
        S::Future: Send,
        S::ResponseBody:
            http::HttpBody<Data = tonic::codegen::Bytes, Error = Error> + Default + Send + 'static,
    {
        // The initial set of policies never expire from the cache.
        //
        // Policies that are dynamically discovered at runtime will expire after
        // `idle_timeout` to prevent holding policy watches indefinitely for
        // ports that are generally unused.
        let cache = {
            let rxs = ports.into_iter().map(|port| {
                let discover = discover.clone();
                let default = default.clone();
                let rx = info_span!("watch", port)
                    .in_scope(|| discover.spawn_with_init(port, default.into()));
                (port, rx)
            });
            Cache::with_permanent_from_iter(idle_timeout, rxs)
        };
        Self {
            cache,
            discover: Some(discover),
            default_rx: Self::spawn_default(default),
        }
    }
pub ( super ) fn spawn_discover ( default : DefaultPolicy , idle_timeout : Duration , discover : api :: Watch < S > , ports : HashSet < u16 > , ) -> Self where S : tonic :: client :: GrpcService < tonic :: body :: BoxBody , Error = Error > , S : Clone + Send + Sync + ' static , S :: Future : Send , S :: ResponseBody : http :: HttpBody < Data = tonic :: codegen :: Bytes , Error = Error > + Default + Send + ' static , { // The initial set of policies never expire from the cache. // // Policies that are dynamically discovered at runtime will expire after // `idle_timeout` to prevent holding policy watches indefinitely for // ports that are generally unused. let cache = { let rxs = ports . into_iter ( ) . map ( | port | { let discover = discover . clone ( ) ; let default = default . clone ( ) ; let rx = info_span ! ( " " port ) . in_scope ( | | discover . spawn_with_init ( port , default . into ( ) ) ) ; ( port , rx ) } ) ; Cache :: with_permanent_from_iter ( idle_timeout , rxs ) } ; Self { cache , discover : Some ( discover ) , default_rx : Self :: spawn_default ( default ) , } }
Spawns a watch for each of the given ports.
Spawns a watch for each of the given ports .
default
DefaultPolicy
idle_timeout
Duration
discover
api::Watch<S>
ports
HashSet<u16>