pub async fn get_single_agent_info(
    env: DbRead<DbKindP2pAgents>,
    _space: DnaHash,
    agent: AgentPubKey
) -> StateQueryResult<Option<AgentInfoSigned>>
Expand description

Helper function to get a single agent info

Examples found in repository?
src/conductor/conductor.rs (line 803)
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
        pub async fn get_agent_infos(
            &self,
            cell_id: Option<CellId>,
        ) -> ConductorApiResult<Vec<AgentInfoSigned>> {
            match cell_id {
                Some(c) => {
                    let (d, a) = c.into_dna_and_agent();
                    let db = self.p2p_agents_db(&d);
                    Ok(get_single_agent_info(db.into(), d, a)
                        .await?
                        .map(|a| vec![a])
                        .unwrap_or_default())
                }
                None => {
                    let mut out = Vec::new();
                    // collecting so the mutex lock can close
                    let envs = self.spaces.get_from_spaces(|s| s.p2p_agents_db.clone());
                    for db in envs {
                        out.append(&mut all_agent_infos(db.into()).await?);
                    }
                    Ok(out)
                }
            }
        }