feat: sync bot keyboards and callbacks
Sync telesrv b96f2dd (feat(bot): complete keyboards callbacks and durable delivery). Skipped private docs and preserved public README files per sync rules; normalized the appearance seed log label for public naming.
This commit is contained in:
parent
0c99ae0a9d
commit
bf965f610c
80 changed files with 7212 additions and 349 deletions
36
internal/store/bot_callback.go
Normal file
36
internal/store/bot_callback.go
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"telesrv/internal/domain"
|
||||
)
|
||||
|
||||
// BotCallbackPending is the short-lived, protocol-neutral ownership record for
|
||||
// one messages.getBotCallbackAnswer request. It is deliberately ephemeral: the
|
||||
// durable Bot API update remains in BotAPIUpdateStore, while this record only
|
||||
// coordinates the synchronous client answer across server instances.
|
||||
type BotCallbackPending struct {
|
||||
QueryID int64
|
||||
BotUserID int64
|
||||
UserID int64
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type BotCallbackAnswerPush struct {
|
||||
QueryID int64
|
||||
BotUserID int64
|
||||
Answer domain.BotCallbackAnswer
|
||||
}
|
||||
|
||||
// BotCallbackRegistryStore coordinates callback waiters across processes.
|
||||
// Implementations must make Put and Resolve atomic: query ids cannot be
|
||||
// overwritten and at most one answer may win for the owning bot.
|
||||
type BotCallbackRegistryStore interface {
|
||||
PutBotCallbackPending(ctx context.Context, pending BotCallbackPending, ttl time.Duration) (bool, error)
|
||||
ResolveBotCallback(ctx context.Context, botUserID, queryID int64, answer domain.BotCallbackAnswer) (bool, error)
|
||||
GetBotCallbackAnswer(ctx context.Context, botUserID, queryID int64) (domain.BotCallbackAnswer, bool, error)
|
||||
DeleteBotCallbackPending(ctx context.Context, botUserID, queryID int64) error
|
||||
SubscribeBotCallbackAnswers(ctx context.Context, handle func(context.Context, BotCallbackAnswerPush)) error
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue