pub async fn resync(&mut self, pods: Vec<KubePod>) -> anyhow::Result<()> {
        // First reconcile any deleted pods we might have missed (if it exists in our map, but not
        // in the list)
        let current_pods: HashSet<PodKey> = pods.iter().map(PodKey::from).collect();
        let pods_in_state: HashSet<PodKey> = self.handlers.keys().cloned().collect();
        for pk in pods_in_state.difference(&current_pods) {
            self.enqueue(Event::Deleted(KubePod {
                metadata: ObjectMeta {
                    name: Some(pk.name()),
                    namespace: Some(pk.namespace()),
                    ..Default::default()
                },
                ..Default::default()
            }))
            .await?
        }

        // Now that we've sent off deletes, queue an apply event for all pods
        for pod in pods.into_iter() {
            self.enqueue(Event::Applied(pod)).await?
        }
        Ok(())
    }
/// Resyncs the queue given the list of pods. Pods that exist in the queue but no longer exist
/// in the list will be deleted
// TODO: I really don't like having handle the resync at the kubelet level with this function,
// but we can't do async recursion without boxing, which causes other issues
Resyncs the queue given the list of pods. Pods that exist in the queue but no longer exist
in the list will be deleted
TODO: I really don't like having handle the resync at the kubelet level with this function,
but we can't do async recursion without boxing, which causes other issues
Resyncs the queue given the list of pods . Pods that exist in the queue but no longer exist in the list will be deleted TODO : I really don ' t like having handle the resync at the kubelet level with this function but we can ' t do async recursion without boxing which causes other issues
pub async fn resync(&mut self, pods: Vec<KubePod>) -> anyhow::Result<()> {
        // First reconcile any deleted pods we might have missed (if it exists in our map, but not
        // in the list)
        let current_pods: HashSet<PodKey> = pods.iter().map(PodKey::from).collect();
        let pods_in_state: HashSet<PodKey> = self.handlers.keys().cloned().collect();
        for pk in pods_in_state.difference(&current_pods) {
            self.enqueue(Event::Deleted(KubePod {
                metadata: ObjectMeta {
                    name: Some(pk.name()),
                    namespace: Some(pk.namespace()),
                    ..Default::default()
                },
                ..Default::default()
            }))
            .await?
        }
        // Now that we've sent off deletes, queue an apply event for all pods
        for pod in pods.into_iter() {
            self.enqueue(Event::Applied(pod)).await?
        }
        Ok(())
    }
pub async fn resync ( & mut self , pods : Vec < KubePod > ) -> anyhow :: Result < ( ) > { // First reconcile any deleted pods we might have missed (if it exists in our map, but not // in the list) let current_pods : HashSet < PodKey > = pods . iter ( ) . map ( PodKey :: from ) . collect ( ) ; let pods_in_state : HashSet < PodKey > = self . handlers . keys ( ) . cloned ( ) . collect ( ) ; for pk in pods_in_state . difference ( & current_pods ) { self . enqueue ( Event :: Deleted ( KubePod { metadata : ObjectMeta { name : Some ( pk . name ( ) ) , namespace : Some ( pk . namespace ( ) ) , .. Default :: default ( ) } , .. Default :: default ( ) } ) ) . await ? } // Now that we've sent off deletes, queue an apply event for all pods for pod in pods . into_iter ( ) { self . enqueue ( Event :: Applied ( pod ) ) . await ? } Ok ( ( ) ) }
Resyncs the queue given the list of pods.
Resyncs the queue given the list of pods .
&mut self
pods
Vec<KubePod>
&mut self
pods
Vec<KubePod>