pub fn process_signal(&mut self, sig: Signal) {
        let num_instances = self.num_instances;
        match sig {
            Signal::Trace(ref aw) => {
                let aw = aw.clone();
                match (self.current_checker(), aw.action().clone()) {
                    // Pair every `SignalZomeFunctionCall` with one `ReturnZomeFunctionResult`
                    (_, Action::SignalZomeFunctionCall(call)) => match self.sender_rx.try_recv() {
                        Ok(sender) => {
                            self.add_call(call.clone(), sender);
                            self.current_checker().unwrap().add(1, move |aw| {
                                if let Action::ReturnZomeFunctionResult(ref r) = *aw.action() {
                                    r.call() == call
                                } else {
                                    false
                                }
                            });
                        }
                        Err(_) => {
                            self.deactivate_current();
                        }
                    },

                    (
                        Some(checker),
                        Action::Commit((committed_entry, link_update_delete, _provenances)),
                    ) => {
                        // Pair every `Commit` with N `Hold`s of that same entry, regardless of type
                        // TODO: is there a possiblity that this can get messed up if the same
                        // entry is committed multiple times?
                        let committed_entry_clone = committed_entry.clone();
                        checker.add(num_instances, move |aw| {
                            //println!("WAITER: Action::Commit -> Action::Hold");
                            match aw.action() {
                                Action::Hold(EntryWithHeader { entry, header: _ }) => {
                                    *entry == committed_entry_clone
                                }
                                _ => false,
                            }
                        });

                        match committed_entry.clone() {
                            Entry::App(_, _) => {
                                if link_update_delete.is_some() {
                                    checker.add(num_instances, move |aw| {
                                        //println!("WAITER: Entry::LinkRemove -> Action::RemoveLink");
                                        *aw.action()
                                            == Action::UpdateEntry((
                                                link_update_delete.clone().expect(
                                                    "Should not fail as link_update is some",
                                                ),
                                                committed_entry.address(),
                                            ))
                                    });
                                }
                            }
                            Entry::Deletion(deletion_entry) => {
                                checker.add(num_instances, move |aw| {
                                    //println!("WAITER: Entry::Deletion -> Action::RemoveEntry");
                                    *aw.action()
                                        == Action::RemoveEntry((
                                            deletion_entry.clone().deleted_entry_address(),
                                            committed_entry.address(),
                                        ))
                                });
                            }

                            Entry::LinkAdd(link_add) => {
                                checker.add(num_instances, move |aw| {
                                    //println!("WAITER: Entry::LinkAdd -> Action::AddLink");
                                    *aw.action() == Action::AddLink(link_add.clone().link().clone())
                                });
                            }
                            Entry::LinkRemove(link_remove) => {
                                checker.add(num_instances, move |aw| {
                                    //println!("WAITER: Entry::LinkRemove -> Action::RemoveLink");
                                    *aw.action()
                                        == Action::RemoveLink(link_remove.clone().link().clone())
                                });
                            }
                            _ => (),
                        }
                    }

                    (Some(checker), Action::AddPendingValidation(pending)) => {
                        let address = pending.entry_with_header.entry.address();
                        let workflow = pending.workflow.clone();
                        checker.add(1, move |aw| {
                            //println!("WAITER: Action::AddPendingValidation -> Action::RemovePendingValidation");
                            *aw.action()
                                == Action::RemovePendingValidation((
                                    address.clone(),
                                    workflow.clone(),
                                ))
                        });
                    }

                    // Don't need to check for message stuff since hdk::send is blocking

                    // (Some(checker), Action::SendDirectMessage(data)) => {
                    //     let msg_id = data.msg_id;
                    //     match data.message {
                    //         DirectMessage::Custom(_) => {
                    //             checker.add(move |aw| {
                    //                 [
                    //                     Action::ResolveDirectConnection(msg_id.clone()),
                    //                     Action::SendDirectMessageTimeout(msg_id.clone()),
                    //                 ]
                    //                 .contains(aw.action())
                    //             });
                    //         }
                    //         _ => (),
                    //     }
                    // }

                    // Note that we ignore anything coming in if there's no active checker,
                    (None, _) => (),

                    // or if it's simply a signal we don't care about
                    _ => (),
                };

                self.run_checks(&aw);
            }

            _ => (),
        };
    }
/// Alter state based on signals that come in, if a checker is registered.
/// A checker gets registered if a ControlSender was passed in from TestConductor.
/// Some signals add a "condition", which is a function looking for other signals.
/// When one of those "checkee" signals comes in, it removes the checker from the state.
Alter state based on signals that come in, if a checker is registered.
A checker gets registered if a ControlSender was passed in from TestConductor.
Some signals add a "condition", which is a function looking for other signals.
When one of those "checkee" signals comes in, it removes the checker from the state.
Alter state based on signals that come in if a checker is registered . A checker gets registered if a ControlSender was passed in from TestConductor . Some signals add a " condition " which is a function looking for other signals . When one of those " checkee " signals comes in it removes the checker from the state .
pub fn process_signal(&mut self, sig: Signal) {
        let num_instances = self.num_instances;
        match sig {
            Signal::Trace(ref aw) => {
                let aw = aw.clone();
                match (self.current_checker(), aw.action().clone()) {
                    // Pair every `SignalZomeFunctionCall` with one `ReturnZomeFunctionResult`
                    (_, Action::SignalZomeFunctionCall(call)) => match self.sender_rx.try_recv() {
                        Ok(sender) => {
                            self.add_call(call.clone(), sender);
                            self.current_checker().unwrap().add(1, move |aw| {
                                if let Action::ReturnZomeFunctionResult(ref r) = *aw.action() {
                                    r.call() == call
                                } else {
                                    false
                                }
                            });
                        }
                        Err(_) => {
                            self.deactivate_current();
                        }
                    },
                    (
                        Some(checker),
                        Action::Commit((committed_entry, link_update_delete, _provenances)),
                    ) => {
                        // Pair every `Commit` with N `Hold`s of that same entry, regardless of type
                        // TODO: is there a possiblity that this can get messed up if the same
                        // entry is committed multiple times?
                        let committed_entry_clone = committed_entry.clone();
                        checker.add(num_instances, move |aw| {
                            //println!("WAITER: Action::Commit -> Action::Hold");
                            match aw.action() {
                                Action::Hold(EntryWithHeader { entry, header: _ }) => {
                                    *entry == committed_entry_clone
                                }
                                _ => false,
                            }
                        });
                        match committed_entry.clone() {
                            Entry::App(_, _) => {
                                if link_update_delete.is_some() {
                                    checker.add(num_instances, move |aw| {
                                        //println!("WAITER: Entry::LinkRemove -> Action::RemoveLink");
                                        *aw.action()
                                            == Action::UpdateEntry((
                                                link_update_delete.clone().expect(
                                                    "Should not fail as link_update is some",
                                                ),
                                                committed_entry.address(),
                                            ))
                                    });
                                }
                            }
                            Entry::Deletion(deletion_entry) => {
                                checker.add(num_instances, move |aw| {
                                    //println!("WAITER: Entry::Deletion -> Action::RemoveEntry");
                                    *aw.action()
                                        == Action::RemoveEntry((
                                            deletion_entry.clone().deleted_entry_address(),
                                            committed_entry.address(),
                                        ))
                                });
                            }
                            Entry::LinkAdd(link_add) => {
                                checker.add(num_instances, move |aw| {
                                    //println!("WAITER: Entry::LinkAdd -> Action::AddLink");
                                    *aw.action() == Action::AddLink(link_add.clone().link().clone())
                                });
                            }
                            Entry::LinkRemove(link_remove) => {
                                checker.add(num_instances, move |aw| {
                                    //println!("WAITER: Entry::LinkRemove -> Action::RemoveLink");
                                    *aw.action()
                                        == Action::RemoveLink(link_remove.clone().link().clone())
                                });
                            }
                            _ => (),
                        }
                    }
                    (Some(checker), Action::AddPendingValidation(pending)) => {
                        let address = pending.entry_with_header.entry.address();
                        let workflow = pending.workflow.clone();
                        checker.add(1, move |aw| {
                            //println!("WAITER: Action::AddPendingValidation -> Action::RemovePendingValidation");
                            *aw.action()
                                == Action::RemovePendingValidation((
                                    address.clone(),
                                    workflow.clone(),
                                ))
                        });
                    }
                    // Don't need to check for message stuff since hdk::send is blocking
                    // (Some(checker), Action::SendDirectMessage(data)) => {
                    //     let msg_id = data.msg_id;
                    //     match data.message {
                    //         DirectMessage::Custom(_) => {
                    //             checker.add(move |aw| {
                    //                 [
                    //                     Action::ResolveDirectConnection(msg_id.clone()),
                    //                     Action::SendDirectMessageTimeout(msg_id.clone()),
                    //                 ]
                    //                 .contains(aw.action())
                    //             });
                    //         }
                    //         _ => (),
                    //     }
                    // }
                    // Note that we ignore anything coming in if there's no active checker,
                    (None, _) => (),
                    // or if it's simply a signal we don't care about
                    _ => (),
                };
                self.run_checks(&aw);
            }
            _ => (),
        };
    }
pub fn process_signal ( & mut self , sig : Signal ) { let num_instances = self . num_instances ; match sig { Signal :: Trace ( ref aw ) => { let aw = aw . clone ( ) ; match ( self . current_checker ( ) , aw . action ( ) . clone ( ) ) { // Pair every `SignalZomeFunctionCall` with one `ReturnZomeFunctionResult` ( _ , Action :: SignalZomeFunctionCall ( call ) ) => match self . sender_rx . try_recv ( ) { Ok ( sender ) => { self . add_call ( call . clone ( ) , sender ) ; self . current_checker ( ) . unwrap ( ) . add ( 1 , move | aw | { if let Action :: ReturnZomeFunctionResult ( ref r ) = * aw . action ( ) { r . call ( ) == call } else { false } } ) ; } Err ( _ ) => { self . deactivate_current ( ) ; } } , ( Some ( checker ) , Action :: Commit ( ( committed_entry , link_update_delete , _provenances ) ) , ) => { // Pair every `Commit` with N `Hold`s of that same entry, regardless of type // TODO: is there a possiblity that this can get messed up if the same // entry is committed multiple times? let committed_entry_clone = committed_entry . clone ( ) ; checker . add ( num_instances , move | aw | { //println!("WAITER: Action::Commit -> Action::Hold"); match aw . action ( ) { Action :: Hold ( EntryWithHeader { entry , header : _ } ) => { * entry == committed_entry_clone } _ => false , } } ) ; match committed_entry . clone ( ) { Entry :: App ( _ , _ ) => { if link_update_delete . is_some ( ) { checker . add ( num_instances , move | aw | { //println!("WAITER: Entry::LinkRemove -> Action::RemoveLink"); * aw . action ( ) == Action :: UpdateEntry ( ( link_update_delete . clone ( ) . expect ( " " , ) , committed_entry . address ( ) , ) ) } ) ; } } Entry :: Deletion ( deletion_entry ) => { checker . add ( num_instances , move | aw | { //println!("WAITER: Entry::Deletion -> Action::RemoveEntry"); * aw . action ( ) == Action :: RemoveEntry ( ( deletion_entry . clone ( ) . deleted_entry_address ( ) , committed_entry . address ( ) , ) ) } ) ; } Entry :: LinkAdd ( link_add ) => { checker . add ( num_instances , move | aw | { //println!("WAITER: Entry::LinkAdd -> Action::AddLink"); * aw . action ( ) == Action :: AddLink ( link_add . clone ( ) . link ( ) . clone ( ) ) } ) ; } Entry :: LinkRemove ( link_remove ) => { checker . add ( num_instances , move | aw | { //println!("WAITER: Entry::LinkRemove -> Action::RemoveLink"); * aw . action ( ) == Action :: RemoveLink ( link_remove . clone ( ) . link ( ) . clone ( ) ) } ) ; } _ => ( ) , } } ( Some ( checker ) , Action :: AddPendingValidation ( pending ) ) => { let address = pending . entry_with_header . entry . address ( ) ; let workflow = pending . workflow . clone ( ) ; checker . add ( 1 , move | aw | { //println!("WAITER: Action::AddPendingValidation -> Action::RemovePendingValidation"); * aw . action ( ) == Action :: RemovePendingValidation ( ( address . clone ( ) , workflow . clone ( ) , ) ) } ) ; } // Don't need to check for message stuff since hdk::send is blocking // (Some(checker), Action::SendDirectMessage(data)) => { //     let msg_id = data.msg_id; //     match data.message { //         DirectMessage::Custom(_) => { //             checker.add(move |aw| { //                 [ //                     Action::ResolveDirectConnection(msg_id.clone()), //                     Action::SendDirectMessageTimeout(msg_id.clone()), //                 ] //                 .contains(aw.action()) //             }); //         } //         _ => (), //     } // } // Note that we ignore anything coming in if there's no active checker, ( None , _ ) => ( ) , // or if it's simply a signal we don't care about _ => ( ) , } ; self . run_checks ( & aw ) ; } _ => ( ) , } ; }
Alter state based on signals that come in, if a checker is registered.
Alter state based on signals that come in if a checker is registered .
&mut self
sig
Signal
&mut self
sig
Signal