feat: add durable result journal and subscription delivery core

This commit is contained in:
2026-09-17 19:19:57 +08:00
parent 309ed75666
commit 1c3300cc5b
26 changed files with 2036 additions and 11 deletions

View File

@@ -13,10 +13,20 @@ type Subscription struct {
Name string `db:"name"`
// CredentialID 关联的命名空间凭据标识。
CredentialID core.ID `db:"credential_id"`
// Filter 订阅过滤规则的 JSON 文档。
// Filter 冻结的结果事件类型数组JSON;创建后不能改写,以免静默漏消费。
Filter core.JSON `db:"filter"`
// Enabled 是否启用;关闭后拒绝相应的新接入或新操作。
// Enabled 是否启用新交付;暂停不撤销已发出的结果,也不拒绝有效确认。
Enabled bool `db:"enabled"`
// QueueID 创建时冻结的队列;历史占位记录为空且不允许消费。
QueueID *core.ID `db:"queue_id"`
// CursorSequence 已扫描并物化交付的结果序号,不表示消费者已确认。
CursorSequence uint64 `db:"cursor_sequence"`
// PendingCount 未确认交付数,包含次数耗尽记录;每次有效确认只减一次。
PendingCount uint32 `db:"pending_count"`
// MaxPending 未确认交付上限,1至1000;达到后保留来源日志并暂停物化。
MaxPending uint32 `db:"max_pending"`
// MaxAttempts 新交付的初始发送次数上限,1至100,不等同于任务执行次数。
MaxAttempts uint32 `db:"max_attempts"`
}
func (Subscription) TableName() string { return "orbit_subscriptions" }