pub async fn handle_aingle_p2p_event(
        &self,
        evt: aingle_p2p::event::AIngleP2pEvent,
    ) -> CellResult<()> {
        use aingle_p2p::event::AIngleP2pEvent::*;
        match evt {
            PutAgentInfoSigned { .. } | GetAgentInfoSigned { .. } | QueryAgentInfoSigned { .. } => {
                // PutAgentInfoSigned needs to be handled at the conductor level where the p2p
                // store lives.
                unreachable!()
            }
            PutMetricDatum { .. } | QueryMetrics { .. } => {
                // Same goes for metrics
                unreachable!()
            }
            CallRemote {
                span_context: _,
                from_agent,
                zome_name,
                fn_name,
                cap,
                respond,
                payload,
                ..
            } => {
                async {
                    let res = self
                        .handle_call_remote(from_agent, zome_name, fn_name, cap, payload)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("call_remote"))
                .await;
            }
            Publish {
                span_context,
                respond,
                from_agent,
                request_validation_receipt,
                sgd_hash,
                ops,
                ..
            } => {
                async {
                    tracing::Span::set_current_context(span_context);
                    let res = self
                        .handle_publish(from_agent, request_validation_receipt, sgd_hash, ops)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_publish"))
                .await;
            }
            GetValidationPackage {
                span_context: _,
                respond,
                header_hash,
                ..
            } => {
                async {
                    let res = self
                        .handle_get_validation_package(header_hash)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_get_validation_package"))
                .await;
            }
            Get {
                span_context: _,
                respond,
                sgd_hash,
                options,
                ..
            } => {
                async {
                    let res = self
                        .handle_get(sgd_hash, options)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_get"))
                .await;
            }
            GetMeta {
                span_context: _,
                respond,
                sgd_hash,
                options,
                ..
            } => {
                async {
                    let res = self
                        .handle_get_meta(sgd_hash, options)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_get_meta"))
                .await;
            }
            GetLinks {
                span_context: _,
                respond,
                link_key,
                options,
                ..
            } => {
                async {
                    let res = self
                        .handle_get_links(link_key, options)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_get_links"))
                .await;
            }
            GetAgentActivity {
                span_context: _,
                respond,
                agent,
                query,
                options,
                ..
            } => {
                async {
                    let res = self
                        .handle_get_agent_activity(agent, query, options)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_get_agent_activity"))
                .await;
            }
            ValidationReceiptReceived {
                span_context: _,
                respond,
                receipt,
                ..
            } => {
                async {
                    let res = self
                        .handle_validation_receipt(receipt)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_validation_receipt_received"))
                .await;
            }
            FetchOpHashesForConstraints {
                span_context: _,
                respond,
                sgd_arc,
                since,
                until,
                ..
            } => {
                async {
                    let res = self
                        .handle_fetch_op_hashes_for_constraints(sgd_arc, since, until)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_fetch_op_hashes_for_constraints"))
                .await;
            }
            FetchOpHashData {
                span_context: _,
                respond,
                op_hashes,
                ..
            } => {
                async {
                    let res = self
                        .handle_fetch_op_hash_data(op_hashes)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_fetch_op_hash_data"))
                .await;
            }
            SignNetworkData {
                span_context: _,
                respond,
                ..
            } => {
                async {
                    let res = self
                        .handle_sign_network_data()
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_sign_network_data"))
                .await;
            }
        }
        Ok(())
    }
/// Entry point for incoming messages from the network that need to be handled
Entry point for incoming messages from the network that need to be handled
Entry point for incoming messages from the network that need to be handled
pub async fn handle_aingle_p2p_event(
        &self,
        evt: aingle_p2p::event::AIngleP2pEvent,
    ) -> CellResult<()> {
        use aingle_p2p::event::AIngleP2pEvent::*;
        match evt {
            PutAgentInfoSigned { .. } | GetAgentInfoSigned { .. } | QueryAgentInfoSigned { .. } => {
                // PutAgentInfoSigned needs to be handled at the conductor level where the p2p
                // store lives.
                unreachable!()
            }
            PutMetricDatum { .. } | QueryMetrics { .. } => {
                // Same goes for metrics
                unreachable!()
            }
            CallRemote {
                span_context: _,
                from_agent,
                zome_name,
                fn_name,
                cap,
                respond,
                payload,
                ..
            } => {
                async {
                    let res = self
                        .handle_call_remote(from_agent, zome_name, fn_name, cap, payload)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("call_remote"))
                .await;
            }
            Publish {
                span_context,
                respond,
                from_agent,
                request_validation_receipt,
                sgd_hash,
                ops,
                ..
            } => {
                async {
                    tracing::Span::set_current_context(span_context);
                    let res = self
                        .handle_publish(from_agent, request_validation_receipt, sgd_hash, ops)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_publish"))
                .await;
            }
            GetValidationPackage {
                span_context: _,
                respond,
                header_hash,
                ..
            } => {
                async {
                    let res = self
                        .handle_get_validation_package(header_hash)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_get_validation_package"))
                .await;
            }
            Get {
                span_context: _,
                respond,
                sgd_hash,
                options,
                ..
            } => {
                async {
                    let res = self
                        .handle_get(sgd_hash, options)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_get"))
                .await;
            }
            GetMeta {
                span_context: _,
                respond,
                sgd_hash,
                options,
                ..
            } => {
                async {
                    let res = self
                        .handle_get_meta(sgd_hash, options)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_get_meta"))
                .await;
            }
            GetLinks {
                span_context: _,
                respond,
                link_key,
                options,
                ..
            } => {
                async {
                    let res = self
                        .handle_get_links(link_key, options)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_get_links"))
                .await;
            }
            GetAgentActivity {
                span_context: _,
                respond,
                agent,
                query,
                options,
                ..
            } => {
                async {
                    let res = self
                        .handle_get_agent_activity(agent, query, options)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_get_agent_activity"))
                .await;
            }
            ValidationReceiptReceived {
                span_context: _,
                respond,
                receipt,
                ..
            } => {
                async {
                    let res = self
                        .handle_validation_receipt(receipt)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_validation_receipt_received"))
                .await;
            }
            FetchOpHashesForConstraints {
                span_context: _,
                respond,
                sgd_arc,
                since,
                until,
                ..
            } => {
                async {
                    let res = self
                        .handle_fetch_op_hashes_for_constraints(sgd_arc, since, until)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_fetch_op_hashes_for_constraints"))
                .await;
            }
            FetchOpHashData {
                span_context: _,
                respond,
                op_hashes,
                ..
            } => {
                async {
                    let res = self
                        .handle_fetch_op_hash_data(op_hashes)
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_fetch_op_hash_data"))
                .await;
            }
            SignNetworkData {
                span_context: _,
                respond,
                ..
            } => {
                async {
                    let res = self
                        .handle_sign_network_data()
                        .await
                        .map_err(aingle_p2p::AIngleP2pError::other);
                    respond.respond(Ok(async move { res }.boxed().into()));
                }
                .instrument(debug_span!("cell_handle_sign_network_data"))
                .await;
            }
        }
        Ok(())
    }
pub async fn handle_aingle_p2p_event ( & self , evt : aingle_p2p :: event :: AIngleP2pEvent , ) -> CellResult < ( ) > { use aingle_p2p :: event :: AIngleP2pEvent :: * ; match evt { PutAgentInfoSigned { .. } | GetAgentInfoSigned { .. } | QueryAgentInfoSigned { .. } => { // PutAgentInfoSigned needs to be handled at the conductor level where the p2p // store lives. unreachable ! ( ) } PutMetricDatum { .. } | QueryMetrics { .. } => { // Same goes for metrics unreachable ! ( ) } CallRemote { span_context : _ , from_agent , zome_name , fn_name , cap , respond , payload , .. } => { async { let res = self . handle_call_remote ( from_agent , zome_name , fn_name , cap , payload ) . await . map_err ( aingle_p2p :: AIngleP2pError :: other ) ; respond . respond ( Ok ( async move { res } . boxed ( ) . into ( ) ) ) ; } . instrument ( debug_span ! ( " " ) ) . await ; } Publish { span_context , respond , from_agent , request_validation_receipt , sgd_hash , ops , .. } => { async { tracing :: Span :: set_current_context ( span_context ) ; let res = self . handle_publish ( from_agent , request_validation_receipt , sgd_hash , ops ) . await . map_err ( aingle_p2p :: AIngleP2pError :: other ) ; respond . respond ( Ok ( async move { res } . boxed ( ) . into ( ) ) ) ; } . instrument ( debug_span ! ( " " ) ) . await ; } GetValidationPackage { span_context : _ , respond , header_hash , .. } => { async { let res = self . handle_get_validation_package ( header_hash ) . await . map_err ( aingle_p2p :: AIngleP2pError :: other ) ; respond . respond ( Ok ( async move { res } . boxed ( ) . into ( ) ) ) ; } . instrument ( debug_span ! ( " " ) ) . await ; } Get { span_context : _ , respond , sgd_hash , options , .. } => { async { let res = self . handle_get ( sgd_hash , options ) . await . map_err ( aingle_p2p :: AIngleP2pError :: other ) ; respond . respond ( Ok ( async move { res } . boxed ( ) . into ( ) ) ) ; } . instrument ( debug_span ! ( " " ) ) . await ; } GetMeta { span_context : _ , respond , sgd_hash , options , .. } => { async { let res = self . handle_get_meta ( sgd_hash , options ) . await . map_err ( aingle_p2p :: AIngleP2pError :: other ) ; respond . respond ( Ok ( async move { res } . boxed ( ) . into ( ) ) ) ; } . instrument ( debug_span ! ( " " ) ) . await ; } GetLinks { span_context : _ , respond , link_key , options , .. } => { async { let res = self . handle_get_links ( link_key , options ) . await . map_err ( aingle_p2p :: AIngleP2pError :: other ) ; respond . respond ( Ok ( async move { res } . boxed ( ) . into ( ) ) ) ; } . instrument ( debug_span ! ( " " ) ) . await ; } GetAgentActivity { span_context : _ , respond , agent , query , options , .. } => { async { let res = self . handle_get_agent_activity ( agent , query , options ) . await . map_err ( aingle_p2p :: AIngleP2pError :: other ) ; respond . respond ( Ok ( async move { res } . boxed ( ) . into ( ) ) ) ; } . instrument ( debug_span ! ( " " ) ) . await ; } ValidationReceiptReceived { span_context : _ , respond , receipt , .. } => { async { let res = self . handle_validation_receipt ( receipt ) . await . map_err ( aingle_p2p :: AIngleP2pError :: other ) ; respond . respond ( Ok ( async move { res } . boxed ( ) . into ( ) ) ) ; } . instrument ( debug_span ! ( " " ) ) . await ; } FetchOpHashesForConstraints { span_context : _ , respond , sgd_arc , since , until , .. } => { async { let res = self . handle_fetch_op_hashes_for_constraints ( sgd_arc , since , until ) . await . map_err ( aingle_p2p :: AIngleP2pError :: other ) ; respond . respond ( Ok ( async move { res } . boxed ( ) . into ( ) ) ) ; } . instrument ( debug_span ! ( " " ) ) . await ; } FetchOpHashData { span_context : _ , respond , op_hashes , .. } => { async { let res = self . handle_fetch_op_hash_data ( op_hashes ) . await . map_err ( aingle_p2p :: AIngleP2pError :: other ) ; respond . respond ( Ok ( async move { res } . boxed ( ) . into ( ) ) ) ; } . instrument ( debug_span ! ( " " ) ) . await ; } SignNetworkData { span_context : _ , respond , .. } => { async { let res = self . handle_sign_network_data ( ) . await . map_err ( aingle_p2p :: AIngleP2pError :: other ) ; respond . respond ( Ok ( async move { res } . boxed ( ) . into ( ) ) ) ; } . instrument ( debug_span ! ( " " ) ) . await ; } } Ok ( ( ) ) }
Entry point for incoming messages from the network that need to be handled
Entry point for incoming messages from the network that need to be handled
&self
evt
aingle_p2p::event::AIngleP2pEvent
&self
evt
aingle_p2p::event::AIngleP2pEvent