pub struct GroupManager { /* private fields */ }Implementations§
Source§impl GroupManager
impl GroupManager
pub fn new(local_device_id: DeviceId, router: Arc<Router>) -> Self
Sourcepub fn register_device_key(
&self,
device_id: DeviceId,
public_key: PublicKey,
) -> Result<()>
pub fn register_device_key( &self, device_id: DeviceId, public_key: PublicKey, ) -> Result<()>
注册设备公钥到 TreeKEM 引擎
pub async fn create_group( &self, name: String, initial_members: Vec<DeviceId>, ) -> Result<Group>
pub async fn add_member( &self, group_id: GroupId, device_id: DeviceId, ) -> Result<()>
pub async fn join_group(&self, group: Group) -> Result<()>
pub async fn leave_group(&self, group_id: GroupId) -> Result<()>
pub async fn get_group(&self, group_id: GroupId) -> Option<Group>
Sourcepub fn clear_groups(&self)
pub fn clear_groups(&self)
清理所有群组信息,防止内存泄漏 - use proper entry removal to avoid DashMap fragmentation
pub async fn broadcast( &self, group_id: GroupId, payload: MessagePayload, ) -> Result<Uuid>
Sourcepub async fn mark_device_success(&self, msg_id: Uuid, device_id: DeviceId)
pub async fn mark_device_success(&self, msg_id: Uuid, device_id: DeviceId)
标记设备为成功接收(收到ACK)
Sourcepub async fn mark_device_failed(&self, msg_id: Uuid, device_id: DeviceId)
pub async fn mark_device_failed(&self, msg_id: Uuid, device_id: DeviceId)
标记设备为失败(无法送达或超时)
Sourcepub async fn rotate_group_key(&self, group_id: GroupId) -> Result<()>
pub async fn rotate_group_key(&self, group_id: GroupId) -> Result<()>
执行群组密钥更新(前向保密性)
pub fn encrypt_group_message( &self, group_id: GroupId, payload: &MessagePayload, ) -> Result<MessagePayload>
pub fn decrypt_group_message( &self, group_id: GroupId, encrypted_payload: &MessagePayload, ) -> Result<MessagePayload>
Sourcepub async fn handle_key_update(
&self,
group_id: GroupId,
epoch: u64,
_update_path: Vec<u8>,
) -> Result<()>
pub async fn handle_key_update( &self, group_id: GroupId, epoch: u64, _update_path: Vec<u8>, ) -> Result<()>
处理群组密钥更新
Sourcepub async fn handle_ack(&self, original_msg_id: Uuid, responder: DeviceId)
pub async fn handle_ack(&self, original_msg_id: Uuid, responder: DeviceId)
处理ACK消息
Sourcepub async fn cleanup_expired_broadcast_results(&self)
pub async fn cleanup_expired_broadcast_results(&self)
清理过期的广播结果通道,防止内存泄漏
Sourcepub fn cleanup_expired_invites(&self, max_age_hours: u64)
pub fn cleanup_expired_invites(&self, max_age_hours: u64)
清理过期的邀请记录,防止内存泄漏
Sourcepub async fn update_member_state(
&self,
group_id: GroupId,
device_id: DeviceId,
status: MemberStatus,
) -> Result<()>
pub async fn update_member_state( &self, group_id: GroupId, device_id: DeviceId, status: MemberStatus, ) -> Result<()>
更新群组成员状态
Sourcepub async fn notify_group_state_change(&self, group_id: GroupId)
pub async fn notify_group_state_change(&self, group_id: GroupId)
通知群组状态变更
Sourcepub async fn broadcast_large_group(
&self,
group_id: GroupId,
payload: MessagePayload,
) -> Result<Vec<Uuid>>
pub async fn broadcast_large_group( &self, group_id: GroupId, payload: MessagePayload, ) -> Result<Vec<Uuid>>
大规模群组性能优化 - 分层广播
pub async fn handle_incoming_group_message( &self, message: &Message, ) -> Result<()>
Auto Trait Implementations§
impl Freeze for GroupManager
impl !RefUnwindSafe for GroupManager
impl Send for GroupManager
impl Sync for GroupManager
impl Unpin for GroupManager
impl !UnwindSafe for GroupManager
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
Mutably borrows from an owned value. Read more
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>
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 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>
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