merged from gramsrv upstream

This commit is contained in:
onysd 2026-09-01 12:06:31 +03:00
parent 79c64ee916
commit 21a0856587
651 changed files with 54774 additions and 4590 deletions

View file

@ -2,11 +2,18 @@ package store
import (
"context"
"errors"
"time"
"telesrv/internal/domain"
)
// MaxActiveChannelMemberPairs bounds every exact channel-membership store
// request independently of caller-side privacy projection admission.
const MaxActiveChannelMemberPairs = 65536
var ErrActiveChannelMemberPairsLimit = errors.New("active channel membership pair limit exceeded")
// ChannelStore persists Telegram channels/supergroups and their single-copy messages.
type ChannelStore interface {
CreateChannel(ctx context.Context, req domain.CreateChannelRequest) (domain.CreateChannelResult, error)
@ -189,6 +196,10 @@ type ChannelStore interface {
ListActiveChannelMembers(ctx context.Context, viewerUserID, channelID int64, limit int) (domain.Channel, domain.ChannelMember, []domain.ChannelMember, error)
ListChannelInviteAdminMemberIDs(ctx context.Context, channelID int64, limit int) ([]int64, error)
FilterActiveChannelMemberIDs(ctx context.Context, channelID int64, userIDs []int64) ([]int64, error)
// FilterActiveChannelMemberPairs intersects only the supplied channel->user
// edges. Implementations must keep this as one bounded batch rather than
// widening it into channels x users or issuing one query per channel.
FilterActiveChannelMemberPairs(ctx context.Context, userIDsByChannel map[int64][]int64) (map[int64][]int64, error)
// FilterChannelMessageAudienceIDs authoritatively intersects a bounded online
// candidate set with users allowed to receive channel message-box updates:
// active members plus non-banned public-channel preview subscribers.