Files
orbit/platform/model/subscription.go

39 lines
1.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package model
import (
"time"
core "git.yuntuo.hk/k2safe/orbit/model"
)
// Subscription 表示事件订阅配置,绑定授权凭据及过滤规则。
// 对应表 orbit_subscriptions;这是服务端持久化模型,不直接作为 API 响应。
type Subscription struct {
// Record 包含命名空间、记录标识、并发版本和 UTC 时间。
core.Record
// RetiredAt 永久退役的UTC时间;空表示未退役,暂停仍占活动名额。
RetiredAt *time.Time `db:"retired_at"`
// RetiredSequence 退役时锁定的结果流提交水位;空表示未退役,后续结果不再订阅。
RetiredSequence *uint64 `db:"retired_sequence"`
// 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" }