Function holochain::conductor::p2p_agent_store::dump_state
source · pub async fn dump_state(
env: DbRead<DbKindP2pAgents>,
cell_id: Option<CellId>
) -> StateQueryResult<P2pAgentsDump>
Expand description
Dump the agents currently in the peer store
Examples found in repository?
More examples
src/conductor/conductor.rs (line 1901)
1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942
pub async fn dump_cell_state(&self, cell_id: &CellId) -> ConductorApiResult<String> {
let cell = self.cell_by_id(cell_id)?;
let authored_db = cell.authored_db();
let dht_db = cell.dht_db();
let space = cell_id.dna_hash();
let p2p_agents_db = self.p2p_agents_db(space);
let peer_dump =
p2p_agent_store::dump_state(p2p_agents_db.into(), Some(cell_id.clone())).await?;
let source_chain_dump = source_chain::dump_state(
authored_db.clone().into(),
cell_id.agent_pubkey().clone(),
)
.await?;
let out = JsonDump {
peer_dump,
source_chain_dump,
integration_dump: integration_dump(&dht_db.clone().into()).await?,
};
// Add summary
let summary = out.to_string();
let out = (out, summary);
Ok(serde_json::to_string_pretty(&out)?)
}
/// Create a comprehensive structured dump of a cell's state
pub async fn dump_full_cell_state(
&self,
cell_id: &CellId,
dht_ops_cursor: Option<u64>,
) -> ConductorApiResult<FullStateDump> {
let authored_db = self.get_or_create_authored_db(cell_id.dna_hash())?;
let dht_db = self.get_or_create_dht_db(cell_id.dna_hash())?;
let dna_hash = cell_id.dna_hash();
let p2p_agents_db = self.spaces.p2p_agents_db(dna_hash)?;
let peer_dump =
p2p_agent_store::dump_state(p2p_agents_db.into(), Some(cell_id.clone())).await?;
let source_chain_dump =
source_chain::dump_state(authored_db.into(), cell_id.agent_pubkey().clone())
.await?;
let out = FullStateDump {
peer_dump,
source_chain_dump,
integration_dump: full_integration_dump(&dht_db, dht_ops_cursor).await?,
};
Ok(out)
}