de_mls/app/user/
registry.rs1use crate::{
4 app::{SessionEntry, User, UserError},
5 core::{ConsensusPlugin, ConversationPluginsFactory},
6};
7
8impl<P: ConsensusPlugin, CP: ConversationPluginsFactory> User<P, CP> {
9 pub fn lookup_entry(
14 &self,
15 conversation_name: &str,
16 ) -> Result<Option<SessionEntry<P, CP>>, UserError> {
17 Ok(self
18 .conversations
19 .read()
20 .map_err(|_| UserError::LockPoisoned("conversation registry"))?
21 .get(conversation_name)
22 .cloned())
23 }
24
25 pub fn list_conversations(&self) -> Result<Vec<String>, UserError> {
27 Ok(self
28 .conversations
29 .read()
30 .map_err(|_| UserError::LockPoisoned("conversation registry"))?
31 .keys()
32 .cloned()
33 .collect())
34 }
35}