feat: sync recent call and channel fixes

This commit is contained in:
A 2026-07-01 14:34:59 +08:00
parent e5e0080216
commit 866a87583e
65 changed files with 6680 additions and 229 deletions

View file

@ -11,12 +11,21 @@ import (
type GroupCallStore interface {
// CreateGroupCall 建会;同频道已有活跃通话返回 domain.ErrGroupCallAlreadyStarted。
CreateGroupCall(ctx context.Context, call domain.GroupCall) (domain.GroupCall, error)
// CreateConferenceCall 建 ad-hoc conference;同一 creator+random_id 幂等返回既有活跃会。
CreateConferenceCall(ctx context.Context, call domain.GroupCall) (domain.GroupCall, error)
GetGroupCall(ctx context.Context, callID int64) (domain.GroupCall, bool, error)
GetGroupCallBySlug(ctx context.Context, slug string) (domain.GroupCall, bool, error)
GetGroupCallByInviteMessage(ctx context.Context, userID int64, msgID int) (domain.GroupCall, domain.GroupCallInvite, bool, error)
// JoinGroupCall 加入/重进(同主键 upsert 换新 ssrc);ssrc 与他人撞活跃唯一
// 约束返回 domain.ErrGroupCallSSRCDuplicate;version++。
JoinGroupCall(ctx context.Context, req domain.JoinGroupCallRequest) (domain.GroupCallMutation, error)
// LeaveGroupCall 置 left+version++;未在会返回 domain.ErrGroupCallNotJoined。
// LeaveGroupCall 置 left+version++;conference 最后一名活跃参与者离开时同步转
// discarded,普通 channel group call 允许空房间继续 active;未在会返回
// domain.ErrGroupCallNotJoined。
LeaveGroupCall(ctx context.Context, callID, userID int64, now int) (domain.GroupCallMutation, error)
// RemoveConferenceCallParticipants 在同一事务内接受 conference E2E remove block、
// 清理目标的 E2E 成员标记,并在 kick 时把活跃参与者置 left。
RemoveConferenceCallParticipants(ctx context.Context, req domain.RemoveConferenceCallParticipantsRequest) (domain.RemoveConferenceCallParticipantsResult, error)
// DiscardGroupCall 终结通话并清空参与者,返回终态 call 与此前活跃的参与者。
DiscardGroupCall(ctx context.Context, callID int64, now int) (domain.GroupCall, []domain.GroupCallParticipant, error)
// TouchParticipant 刷新 checkGroupCall 保活水位,返回该用户当前活跃 ssrc 集合
@ -36,7 +45,7 @@ type GroupCallStore interface {
//(每清一人 version++)。注意调用方必须叠加 SFU 媒体面活性做双过期判定。
SweepStaleParticipants(ctx context.Context, checkOlderThan, now int, limit int) ([]domain.GroupCallMutation, error)
// ResetAllParticipants 服务端重启恢复:把全部活跃通话的参与者批量置 left
//(每通话 version++),返回受影响的通话。
//(每通话 version++),conference 若因此变空则同步转 discarded,返回受影响的通话。
ResetAllParticipants(ctx context.Context, now int) ([]domain.GroupCall, error)
// NextRaiseHandRating 分配全局单调递增的举手序号(举手排序用)。
NextRaiseHandRating(ctx context.Context, callID int64) (int64, error)
@ -45,4 +54,13 @@ type GroupCallStore interface {
SetParticipantOverride(ctx context.Context, callID, setterUserID, targetUserID int64, override domain.GroupCallParticipantOverride, clear bool) error
// GetParticipantOverride 取某 setter 对某 target 的覆盖。
GetParticipantOverride(ctx context.Context, callID, setterUserID, targetUserID int64) (domain.GroupCallParticipantOverride, bool, error)
// CreateConferenceInvite 记录一条 conference 私聊邀请与其 message box id。
CreateConferenceInvite(ctx context.Context, invite domain.GroupCallInvite) (domain.GroupCallInvite, error)
SetConferenceInviteStatus(ctx context.Context, callID int64, inviteeUserID int64, msgID int, status domain.GroupCallInviteStatus, now int) (domain.GroupCallInvite, bool, error)
// ListConferenceRecipientUserIDs 返回 conference 在线推送/访问候选人。
// active 态只包含 creator、当前活跃参与者、pending/accepted invite 相关人;
// discarded 态包含所有历史参与者与 invite 相关人,允许客户端收尾轮询读取终态。
ListConferenceRecipientUserIDs(ctx context.Context, callID int64) ([]int64, error)
AppendGroupCallChainBlock(ctx context.Context, block domain.GroupCallChainBlock) (domain.GroupCallChainBlock, error)
ListGroupCallChainBlocks(ctx context.Context, callID int64, subChainID, offset, limit int) (domain.GroupCallChainBlockPage, error)
}