pub(super) fn spawn_discover<S>(
        default: DefaultPolicy,
        ports: HashSet<u16>,
        discover: discover::Watch<S>,
    ) -> Self
    where
        S: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error>,
        S: Clone + Send + Sync + 'static,
        S::Future: Send,
        S::ResponseBody: http::HttpBody<Error = Error> + Send + Sync + 'static,
    {
        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)
            })
            .collect::<PortMap<_>>();

        let default = match Self::mk_default(default) {
            Some((tx, rx)) => {
                tokio::spawn(async move {
                    tx.closed().await;
                });
                Some(rx)
            }
            None => None,
        };

        Self {
            default,
            ports: Arc::new(rxs),
        }
    }
/// Spawns a watch for each of the given ports.
///
/// The returned future completes when a watch has been successfully created for all of the
/// provided ports. The store maintains these watches so that each time a policy is checked, it
/// may obtain the latest policy provided by the watch. An error is returned if any of the
/// watches cannot be established.
Spawns a watch for each of the given ports.
The returned future completes when a watch has been successfully created for all of the
provided ports. The store maintains these watches so that each time a policy is checked, it
may obtain the latest policy provided by the watch. An error is returned if any of the
watches cannot be established.
Spawns a watch for each of the given ports . The returned future completes when a watch has been successfully created for all of the provided ports . The store maintains these watches so that each time a policy is checked it may obtain the latest policy provided by the watch . An error is returned if any of the watches cannot be established .
pub(super) fn spawn_discover<S>(
        default: DefaultPolicy,
        ports: HashSet<u16>,
        discover: discover::Watch<S>,
    ) -> Self
    where
        S: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error>,
        S: Clone + Send + Sync + 'static,
        S::Future: Send,
        S::ResponseBody: http::HttpBody<Error = Error> + Send + Sync + 'static,
    {
        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)
            })
            .collect::<PortMap<_>>();
        let default = match Self::mk_default(default) {
            Some((tx, rx)) => {
                tokio::spawn(async move {
                    tx.closed().await;
                });
                Some(rx)
            }
            None => None,
        };
        Self {
            default,
            ports: Arc::new(rxs),
        }
    }
pub ( super ) fn spawn_discover < S > ( default : DefaultPolicy , ports : HashSet < u16 > , discover : discover :: Watch < S > , ) -> Self where S : tonic :: client :: GrpcService < tonic :: body :: BoxBody , Error = Error > , S : Clone + Send + Sync + ' static , S :: Future : Send , S :: ResponseBody : http :: HttpBody < Error = Error > + Send + Sync + ' static , { 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 ) } ) . collect :: < PortMap < _ > > ( ) ; let default = match Self :: mk_default ( default ) { Some ( ( tx , rx ) ) => { tokio :: spawn ( async move { tx . closed ( ) . await ; } ) ; Some ( rx ) } None => None , } ; Self { default , ports : Arc :: new ( rxs ) , } }
Spawns a watch for each of the given ports.
Spawns a watch for each of the given ports .
default
DefaultPolicy
ports
HashSet<u16>
discover
discover::Watch<S>
default
DefaultPolicy
ports
HashSet<u16>
discover
discover::Watch<S>