perf: sync protocol and core hardening updates
This commit is contained in:
parent
152fed3b87
commit
4390ebf5a9
283 changed files with 29231 additions and 2295 deletions
|
|
@ -2,11 +2,20 @@ package store
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"telesrv/internal/domain"
|
||||
)
|
||||
|
||||
// ErrDispatchLeaseLost means a completion belongs to an older claim attempt.
|
||||
// Callers must not overwrite/delete the row now owned by a newer worker.
|
||||
var ErrDispatchLeaseLost = errors.New("dispatch outbox lease lost")
|
||||
|
||||
// DispatchOutboxLogicalShards 是稳定的 user→lane 哈希空间。运行时 worker 数
|
||||
// 只能改变 shard 的归属,不能改变这个值;PG 表达式索引也固定使用 256。
|
||||
const DispatchOutboxLogicalShards = 256
|
||||
|
||||
// DispatchOutboxItem 是待投递给在线 session 的 update 任务。
|
||||
type DispatchOutboxItem struct {
|
||||
ID int64
|
||||
|
|
@ -21,7 +30,7 @@ type DispatchOutboxItem struct {
|
|||
// DispatchOutboxStore 持久化 transactional outbox。
|
||||
type DispatchOutboxStore interface {
|
||||
ClaimPending(ctx context.Context, limit int) ([]DispatchOutboxItem, error)
|
||||
MarkDelivered(ctx context.Context, targetUserID, id int64) error
|
||||
MarkFailed(ctx context.Context, targetUserID, id int64, lastError string) error
|
||||
MarkDelivered(ctx context.Context, item DispatchOutboxItem) error
|
||||
MarkFailed(ctx context.Context, item DispatchOutboxItem, lastError string) error
|
||||
DeleteFailed(ctx context.Context, olderThan time.Duration, limit int) (int, error)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue