fn process_batch(
        &mut self,
        src_chain: Box<dyn ChainHandle>,
        batch: EventBatch,
    ) -> Result<(), BoxError> {
        assert_eq!(src_chain.id(), batch.chain_id);

        let height = batch.height;
        let chain_id = batch.chain_id.clone();

        let direction = if chain_id == self.chains.a.id() {
            Direction::AtoB
        } else {
            Direction::BtoA
        };

        let mut collected = collect_events(src_chain.as_ref(), batch);

        for (object, events) in collected.per_object.drain() {
            if events.is_empty() {
                continue;
            }

            println!("[{}] events: {:#?}", chain_id, events);

            if let Some(worker) = self.worker_for_object(object, direction) {
                worker.send_packet_events(height, events, chain_id.clone())?;
            }
        }

        if collected.has_new_blocks() {
            for worker in self.workers.values() {
                worker.send_new_blocks(height, collected.new_blocks.clone())?;
            }
        }

        Ok(())
    }
/// Process a batch of events received from a chain.
Process a batch of events received from a chain.
Process a batch of events received from a chain .
fn process_batch(
        &mut self,
        src_chain: Box<dyn ChainHandle>,
        batch: EventBatch,
    ) -> Result<(), BoxError> {
        assert_eq!(src_chain.id(), batch.chain_id);
        let height = batch.height;
        let chain_id = batch.chain_id.clone();
        let direction = if chain_id == self.chains.a.id() {
            Direction::AtoB
        } else {
            Direction::BtoA
        };
        let mut collected = collect_events(src_chain.as_ref(), batch);
        for (object, events) in collected.per_object.drain() {
            if events.is_empty() {
                continue;
            }
            println!("[{}] events: {:#?}", chain_id, events);
            if let Some(worker) = self.worker_for_object(object, direction) {
                worker.send_packet_events(height, events, chain_id.clone())?;
            }
        }
        if collected.has_new_blocks() {
            for worker in self.workers.values() {
                worker.send_new_blocks(height, collected.new_blocks.clone())?;
            }
        }
        Ok(())
    }
fn process_batch ( & mut self , src_chain : Box < dyn ChainHandle > , batch : EventBatch , ) -> Result < ( ) , BoxError > { assert_eq ! ( src_chain id ( ) batch chain_id ) ; let height = batch . height ; let chain_id = batch . chain_id . clone ( ) ; let direction = if chain_id == self . chains . a . id ( ) { Direction :: AtoB } else { Direction :: BtoA } ; let mut collected = collect_events ( src_chain . as_ref ( ) , batch ) ; for ( object , events ) in collected . per_object . drain ( ) { if events . is_empty ( ) { continue ; } println ! ( " " chain_id events ) ; if let Some ( worker ) = self . worker_for_object ( object , direction ) { worker . send_packet_events ( height , events , chain_id . clone ( ) ) ? ; } } if collected . has_new_blocks ( ) { for worker in self . workers . values ( ) { worker . send_new_blocks ( height , collected . new_blocks . clone ( ) ) ? ; } } Ok ( ( ) ) }
Process a batch of events received from a chain.
Process a batch of events received from a chain .
&mut self
src_chain
Box<dyn ChainHandle>
batch
EventBatch
&mut self
src_chain
Box<dyn ChainHandle>
batch
EventBatch