fn apply_changeset(&mut self, change_set: ChangeSet) {
        for change_action in change_set {
            match change_action {
                ChangeAction::MoveToValidated((message_id, _, _, _, _)) => {
                    // remove it from unvalidated pool and remove it from peer_index, move it
                    // to the validated pool
                    match self.remove_unvalidated(&message_id) {
                        Some((unvalidated_artifact, size)) => {
                            self.validated.insert(
                                message_id,
                                ValidatedIngressArtifact {
                                    msg: unvalidated_artifact.message,
                                    timestamp: unvalidated_artifact.timestamp,
                                },
                            );
                            debug!(
                                self.log,
                                "Ingress pool: move {} bytes from unvalidated to validated", size
                            );
                        }
                        None => {
                            unreachable!(
                                "Unvalidated entry not found for MoveToValidated: {:?}",
                                message_id
                            );
                        }
                    }
                }
                ChangeAction::RemoveFromUnvalidated(message_id) => {
                    match self.remove_unvalidated(&message_id) {
                        Some((_, size)) => {
                            debug!(
                                self.log,
                                "Ingress pool: remove {} bytes from unvalidated", size
                            );
                        }
                        None => {
                            debug!(
                                self.log,
                                "Ingress pool: attempt to remove non-existent unvalidated ingress message {}",
                                message_id
                            );
                        }
                    }
                }
                ChangeAction::RemoveFromValidated(message_id) => {
                    match self.validated.remove(&message_id) {
                        Some(artifact) => {
                            let size = artifact.msg.signed_ingress.count_bytes();
                            debug!(
                                self.log,
                                "Ingress pool: remove {} bytes from validated", size
                            );
                        }
                        None => {
                            debug!(
                                self.log,
                                "Ingress pool: attempt to remove non-existent validated ingress message {}",
                                message_id
                            );
                        }
                    }
                }
                ChangeAction::PurgeBelowExpiry(expiry) => {
                    let _unused = self.validated.purge_below(expiry);
                    for artifact in self.unvalidated.purge_below(expiry) {
                        let size = artifact.message.signed_ingress.count_bytes();
                        self.peer_index.remove(artifact.peer_id, size);
                    }
                }
            }
        }
    }
/// Apply changeset to the Ingress Pool
Apply changeset to the Ingress Pool
Apply changeset to the Ingress Pool
fn apply_changeset(&mut self, change_set: ChangeSet) {
        for change_action in change_set {
            match change_action {
                ChangeAction::MoveToValidated((message_id, _, _, _, _)) => {
                    // remove it from unvalidated pool and remove it from peer_index, move it
                    // to the validated pool
                    match self.remove_unvalidated(&message_id) {
                        Some((unvalidated_artifact, size)) => {
                            self.validated.insert(
                                message_id,
                                ValidatedIngressArtifact {
                                    msg: unvalidated_artifact.message,
                                    timestamp: unvalidated_artifact.timestamp,
                                },
                            );
                            debug!(
                                self.log,
                                "Ingress pool: move {} bytes from unvalidated to validated", size
                            );
                        }
                        None => {
                            unreachable!(
                                "Unvalidated entry not found for MoveToValidated: {:?}",
                                message_id
                            );
                        }
                    }
                }
                ChangeAction::RemoveFromUnvalidated(message_id) => {
                    match self.remove_unvalidated(&message_id) {
                        Some((_, size)) => {
                            debug!(
                                self.log,
                                "Ingress pool: remove {} bytes from unvalidated", size
                            );
                        }
                        None => {
                            debug!(
                                self.log,
                                "Ingress pool: attempt to remove non-existent unvalidated ingress message {}",
                                message_id
                            );
                        }
                    }
                }
                ChangeAction::RemoveFromValidated(message_id) => {
                    match self.validated.remove(&message_id) {
                        Some(artifact) => {
                            let size = artifact.msg.signed_ingress.count_bytes();
                            debug!(
                                self.log,
                                "Ingress pool: remove {} bytes from validated", size
                            );
                        }
                        None => {
                            debug!(
                                self.log,
                                "Ingress pool: attempt to remove non-existent validated ingress message {}",
                                message_id
                            );
                        }
                    }
                }
                ChangeAction::PurgeBelowExpiry(expiry) => {
                    let _unused = self.validated.purge_below(expiry);
                    for artifact in self.unvalidated.purge_below(expiry) {
                        let size = artifact.message.signed_ingress.count_bytes();
                        self.peer_index.remove(artifact.peer_id, size);
                    }
                }
            }
        }
    }
fn apply_changeset ( & mut self , change_set : ChangeSet ) { for change_action in change_set { match change_action { ChangeAction :: MoveToValidated ( ( message_id , _ , _ , _ , _ ) ) => { // remove it from unvalidated pool and remove it from peer_index, move it // to the validated pool match self . remove_unvalidated ( & message_id ) { Some ( ( unvalidated_artifact , size ) ) => { self . validated . insert ( message_id , ValidatedIngressArtifact { msg : unvalidated_artifact . message , timestamp : unvalidated_artifact . timestamp , } , ) ; debug ! ( self log " " size ) ; } None => { unreachable ! ( " " message_id ) ; } } } ChangeAction :: RemoveFromUnvalidated ( message_id ) => { match self . remove_unvalidated ( & message_id ) { Some ( ( _ , size ) ) => { debug ! ( self log " " size ) ; } None => { debug ! ( self log " " message_id ) ; } } } ChangeAction :: RemoveFromValidated ( message_id ) => { match self . validated . remove ( & message_id ) { Some ( artifact ) => { let size = artifact . msg . signed_ingress . count_bytes ( ) ; debug ! ( self log " " size ) ; } None => { debug ! ( self log " " message_id ) ; } } } ChangeAction :: PurgeBelowExpiry ( expiry ) => { let _unused = self . validated . purge_below ( expiry ) ; for artifact in self . unvalidated . purge_below ( expiry ) { let size = artifact . message . signed_ingress . count_bytes ( ) ; self . peer_index . remove ( artifact . peer_id , size ) ; } } } } }
Apply changeset to the Ingress Pool
Apply changeset to the Ingress Pool
&mut self
change_set
ChangeSet
&mut self
change_set
ChangeSet