pub struct User<P: ConsensusPlugin, CP: ConversationPluginsFactory> { /* private fields */ }Implementations§
Source§impl<P: ConsensusPlugin, CP: ConversationPluginsFactory> User<P, CP>
impl<P: ConsensusPlugin, CP: ConversationPluginsFactory> User<P, CP>
Sourcepub async fn process_inbound_packet(
&self,
packet: InboundPacket,
) -> Result<(), UserError>
pub async fn process_inbound_packet( &self, packet: InboundPacket, ) -> Result<(), UserError>
Process an inbound packet. The User-level entry point owns echo dedup, name-based routing, and the welcome subtopic’s plug-in- factory access. App-message packets are handed off to the session for MLS processing and dispatch.
Sourcepub async fn finalize_self_leave(
&self,
conversation_name: &str,
) -> Result<(), UserError>
pub async fn finalize_self_leave( &self, conversation_name: &str, ) -> Result<(), UserError>
User-side completion of LeaveConversation: drop the entry from
the registry, clean up the consensus scope, and broadcast removal.
The session-side teardown (emit Leaving, delete MLS state) runs
inside SessionRunner::dispatch_inbound_result /
SessionRunner::poll_freeze_status /
SessionRunner::check_pending_join; this method is the cleanup
callers run when those signal “registry should be removed”
(DispatchOutcome::LeaveRequested or PendingJoinTick::Expired).
Source§impl<P: ConsensusPlugin, CP: ConversationPluginsFactory> User<P, CP>
impl<P: ConsensusPlugin, CP: ConversationPluginsFactory> User<P, CP>
pub async fn start_conversation( &mut self, conversation_name: &str, is_creation: bool, ) -> Result<(), UserError>
Sourcepub async fn create_conversation_with_config(
&mut self,
conversation_name: &str,
is_creation: bool,
config: ConversationConfig,
) -> Result<(), UserError>
pub async fn create_conversation_with_config( &mut self, conversation_name: &str, is_creation: bool, config: ConversationConfig, ) -> Result<(), UserError>
Like Self::start_conversation but with a per-conversation config override.
Sourcepub async fn leave_conversation(
&mut self,
conversation_name: &str,
) -> Result<(), UserError>
pub async fn leave_conversation( &mut self, conversation_name: &str, ) -> Result<(), UserError>
Leave the conversation. PendingJoin short-circuits to local
teardown (no MLS state yet). Otherwise delegates the protocol work
to the session-side initiate_self_leave — opens a self-leave
consensus session with the leaver’s YES bundled at submit. We stay
active until the next steward commit merges the removal; on that
commit ProcessResult::LeaveConversation fires.
Source§impl<P: ConsensusPlugin, CP: ConversationPluginsFactory> User<P, CP>
impl<P: ConsensusPlugin, CP: ConversationPluginsFactory> User<P, CP>
Sourcepub fn lookup_entry(
&self,
conversation_name: &str,
) -> Result<Option<SessionEntry<P, CP>>, UserError>
pub fn lookup_entry( &self, conversation_name: &str, ) -> Result<Option<SessionEntry<P, CP>>, UserError>
Look up a conversation runner. Returns Ok(None) when no runner is
registered for conversation_name. Takes the outer read lock briefly
to clone the inner Arc, then releases it before the caller
acquires the runner’s own lock.
Source§impl<P: ConsensusPlugin, CP: ConversationPluginsFactory> User<P, CP>
impl<P: ConsensusPlugin, CP: ConversationPluginsFactory> User<P, CP>
Sourcepub fn identity_string(&self) -> String
pub fn identity_string(&self) -> String
Display form of the local identity, derived from
Identity::identity_display. Stable for the lifetime of the
User; intended for logs and UI.
Sourcepub fn generate_key_package(&self) -> Result<KeyPackageBytes, MlsError>
pub fn generate_key_package(&self) -> Result<KeyPackageBytes, MlsError>
Generate a single-use key package for our identity. Conversation-free —
callable before start_conversation. Delegates to the configured
crate::core::ConversationPluginsFactory::generate_key_package.
Sourcepub fn drain_lifecycle_events(&self) -> Vec<ConversationLifecycle>
pub fn drain_lifecycle_events(&self) -> Vec<ConversationLifecycle>
Drain every pending ConversationLifecycle event accumulated
since the last call. Returns events in insertion order. Callers
(gateway, integrator) invoke this once per polling cycle to discover
Created / Removed sessions and wire up per-session event
drains via SessionRunner::drain_events.
Sourcepub fn set_default_scoring_config(&mut self, config: ScoringConfig)
pub fn set_default_scoring_config(&mut self, config: ScoringConfig)
Override the seed ScoringConfig used for newly-created per-conversation
scoring plug-ins. Existing conversations are untouched; their plug-ins
already own their live config (joiner-side overwritten by ConversationSync).
Sourcepub fn set_default_steward_list_config(&mut self, config: StewardListConfig)
pub fn set_default_steward_list_config(&mut self, config: StewardListConfig)
Override the seed StewardListConfig used for newly-created
per-conversation steward-list plug-ins. Same lifecycle as
Self::set_default_scoring_config.
Source§impl<P: ConsensusPlugin, CP: ConversationPluginsFactory> User<P, CP>
impl<P: ConsensusPlugin, CP: ConversationPluginsFactory> User<P, CP>
pub fn new_with_plugins( identity: Box<dyn Identity>, plugins: UserPlugins<P, CP>, transport: SharedDeliveryService, ) -> Self
Auto Trait Implementations§
impl<P, CP> !Freeze for User<P, CP>
impl<P, CP> !RefUnwindSafe for User<P, CP>
impl<P, CP> Send for User<P, CP>where
CP: Send,
<CP as ConversationPluginsFactory>::Scoring: Send + Sync,
<CP as ConversationPluginsFactory>::StewardList: Send + Sync,
<CP as ConversationPluginsFactory>::Mls: Send + Sync,
impl<P, CP> Sync for User<P, CP>where
CP: Sync,
<CP as ConversationPluginsFactory>::Scoring: Send + Sync,
<CP as ConversationPluginsFactory>::StewardList: Send + Sync,
<CP as ConversationPluginsFactory>::Mls: Send + Sync,
impl<P, CP> Unpin for User<P, CP>where
CP: Unpin,
<P as ConsensusPlugin>::ConsensusStorage: Unpin,
<P as ConsensusPlugin>::Signer: Unpin,
impl<P, CP> UnsafeUnpin for User<P, CP>where
CP: UnsafeUnpin,
<P as ConsensusPlugin>::ConsensusStorage: UnsafeUnpin,
<P as ConsensusPlugin>::Signer: UnsafeUnpin,
impl<P, CP> !UnwindSafe for User<P, CP>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more