33 lines
1.5 KiB
Go
33 lines
1.5 KiB
Go
package model
|
||
|
||
import (
|
||
core "git.yuntuo.hk/k2safe/orbit/model"
|
||
)
|
||
|
||
// Subscription 表示事件订阅配置,绑定授权凭据及过滤规则。
|
||
// 对应表 orbit_subscriptions;这是服务端持久化模型,不直接作为 API 响应。
|
||
type Subscription struct {
|
||
// Record 包含命名空间、记录标识、并发版本和 UTC 时间。
|
||
core.Record
|
||
// Name 可读名称,唯一性范围由对应数据表约束。
|
||
Name string `db:"name"`
|
||
// CredentialID 关联的命名空间凭据标识。
|
||
CredentialID core.ID `db:"credential_id"`
|
||
// Filter 冻结的结果事件类型数组JSON;创建后不能改写,以免静默漏消费。
|
||
Filter core.JSON `db:"filter"`
|
||
// 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" }
|