pub struct GroupHandle { /* private fields */ }Expand description
Handle for a single MLS group’s app-level state.
Contains state needed for group operations:
- Application ID for message deduplication across instances
- Steward flag indicating whether this user batches commits
- Proposal queues for tracking voting and approved proposals
Note: MLS cryptographic state (encryption keys, group members) is
managed by MlsService. Use mls_service.encrypt(), mls_service.decrypt(),
etc. for MLS operations.
§Thread Safety
The GroupHandle should be wrapped in RwLock or similar by the
application layer (see User.groups in the app module).
§Steward vs Member
- Steward: Creates proposals, collects votes, batches approved proposals
into MLS commits. Created via
new_as_creator(). - Member: Votes on proposals, receives commits. Created via
new_for_join().
Implementations§
Source§impl GroupHandle
impl GroupHandle
Sourcepub fn new_for_join(group_name: &str) -> Self
pub fn new_for_join(group_name: &str) -> Self
Create a new group handle for an existing group (joining).
§Arguments
group_name- The name of the group
Sourcepub fn new_as_creator(group_name: &str) -> Self
pub fn new_as_creator(group_name: &str) -> Self
Create a new group handle for creating a new group (as steward).
The MLS group should be created via mls_service.create_group() first.
§Arguments
group_name- The name of the group
Sourcepub fn group_name(&self) -> &str
pub fn group_name(&self) -> &str
Get the group name.
Sourcepub fn group_name_bytes(&self) -> &[u8] ⓘ
pub fn group_name_bytes(&self) -> &[u8] ⓘ
Get the group name as bytes.
Sourcepub fn is_steward(&self) -> bool
pub fn is_steward(&self) -> bool
Check if this user is the steward.
Sourcepub fn is_mls_initialized(&self) -> bool
pub fn is_mls_initialized(&self) -> bool
Check if the MLS group is initialized.
Sourcepub fn set_mls_initialized(&mut self)
pub fn set_mls_initialized(&mut self)
Mark MLS as initialized (called after joining via welcome).
Sourcepub fn become_steward(&mut self)
pub fn become_steward(&mut self)
Become the steward of this group.
Sourcepub fn resign_steward(&mut self)
pub fn resign_steward(&mut self)
Resign as steward of this group.
Sourcepub fn is_owner_of_proposal(&self, proposal_id: ProposalId) -> bool
pub fn is_owner_of_proposal(&self, proposal_id: ProposalId) -> bool
Check if this user owns (created) the given proposal.
Owners are responsible for broadcasting the proposal to peers and
must include the full Proposal when casting their vote.
Sourcepub fn approved_proposals_count(&self) -> usize
pub fn approved_proposals_count(&self) -> usize
Get the count of approved proposals waiting to be committed.
The steward checks this to determine when to create a batch commit.
Sourcepub fn approved_proposals(&self) -> HashMap<ProposalId, GroupUpdateRequest>
pub fn approved_proposals(&self) -> HashMap<ProposalId, GroupUpdateRequest>
Get a copy of all approved proposals.
Called by the steward when creating a batch commit. The proposals are sorted by SHA256 hash for deterministic ordering.
Sourcepub fn mark_proposal_as_approved(&mut self, proposal_id: ProposalId)
pub fn mark_proposal_as_approved(&mut self, proposal_id: ProposalId)
Move a proposal from voting to approved queue.
Called when consensus is reached with result = true and this user
is the proposal owner.
Sourcepub fn mark_proposal_as_rejected(&mut self, proposal_id: ProposalId)
pub fn mark_proposal_as_rejected(&mut self, proposal_id: ProposalId)
Remove a proposal from the voting queue (rejected or failed).
Called when consensus is reached with result = false or when
consensus fails (timeout, insufficient votes).
Sourcepub fn store_voting_proposal(
&mut self,
proposal_id: ProposalId,
proposal: GroupUpdateRequest,
)
pub fn store_voting_proposal( &mut self, proposal_id: ProposalId, proposal: GroupUpdateRequest, )
Store a newly created proposal in the voting queue.
Called after start_voting() successfully creates a proposal.
The proposal remains here until consensus completes.
Sourcepub fn insert_approved_proposal(
&mut self,
proposal_id: ProposalId,
proposal: GroupUpdateRequest,
)
pub fn insert_approved_proposal( &mut self, proposal_id: ProposalId, proposal: GroupUpdateRequest, )
Insert a proposal directly into the approved queue.
Called by non-owners when they receive a consensus result for a proposal they didn’t create. They fetch the payload from the consensus service and insert it directly as approved.
Sourcepub fn clear_approved_proposals(&mut self)
pub fn clear_approved_proposals(&mut self)
Clear approved proposals after a commit, archiving to history.
Called after a batch commit is successfully applied. The proposals
are moved to epoch_history for UI display (up to 10 epochs retained).
Sourcepub fn epoch_history(
&self,
) -> &VecDeque<HashMap<ProposalId, GroupUpdateRequest>>
pub fn epoch_history( &self, ) -> &VecDeque<HashMap<ProposalId, GroupUpdateRequest>>
Get the epoch history (past batches of approved proposals).
Returns up to 10 past epochs, most recent last. Useful for UI to show recent membership changes.
Trait Implementations§
Source§impl Clone for GroupHandle
impl Clone for GroupHandle
Source§fn clone(&self) -> GroupHandle
fn clone(&self) -> GroupHandle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for GroupHandle
impl RefUnwindSafe for GroupHandle
impl Send for GroupHandle
impl Sync for GroupHandle
impl Unpin for GroupHandle
impl UnwindSafe for GroupHandle
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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