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

@ -14,6 +14,14 @@ func (a fixedBoxIDAllocator) NextBoxID(context.Context, int64) (int, error) {
return a.next, nil
}
func (a fixedBoxIDAllocator) NextBoxIDs(_ context.Context, userIDs []int64) (map[int64]int, error) {
out := make(map[int64]int, len(userIDs))
for _, userID := range userIDs {
out[userID] = a.next
}
return out, nil
}
func (a fixedBoxIDAllocator) CurrentBoxID(context.Context, int64) (int, error) {
return a.next, nil
}
@ -27,6 +35,16 @@ func (a *perUserCounterAllocator) NextBoxID(_ context.Context, userID int64) (in
return a.next(userID), nil
}
func (a *perUserCounterAllocator) NextBoxIDs(_ context.Context, userIDs []int64) (map[int64]int, error) {
out := make(map[int64]int, len(userIDs))
for _, userID := range userIDs {
if _, ok := out[userID]; !ok {
out[userID] = a.next(userID)
}
}
return out, nil
}
func (a *perUserCounterAllocator) CurrentBoxID(_ context.Context, userID int64) (int, error) {
return a.current(userID), nil
}