Skip to main content

GroupHandle

Struct GroupHandle 

Source
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

Source

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
Source

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
Source

pub fn group_name(&self) -> &str

Get the group name.

Source

pub fn group_name_bytes(&self) -> &[u8]

Get the group name as bytes.

Source

pub fn app_id(&self) -> &[u8]

Get the application ID.

Source

pub fn is_steward(&self) -> bool

Check if this user is the steward.

Source

pub fn is_mls_initialized(&self) -> bool

Check if the MLS group is initialized.

Source

pub fn set_mls_initialized(&mut self)

Mark MLS as initialized (called after joining via welcome).

Source

pub fn become_steward(&mut self)

Become the steward of this group.

Source

pub fn resign_steward(&mut self)

Resign as steward of this group.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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).

Source

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

Source§

fn clone(&self) -> GroupHandle

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GroupHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Classify for T

Source§

type Classified = T

Source§

fn classify(self) -> T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Declassify for T

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more