Files
orbit/examples/http-service/internal/inbox/model.go

29 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 inbox
import "time"
// Record 对应receiver_inbox,与业务视图同事务提交;存在记录才表示该事件处理已提交。
type Record struct {
ConsumerName string // ConsumerName 固定用途名;进程重启及多实例必须复用。
QueueID string // QueueID 固定来源队列,不能从连接会话推导。
EventID string // EventID 稳定事件身份,不使用交付ID或代次。
EventDigest []byte // EventDigest 32字节SHA256,防止同事件身份被换成不同内容。
EventJSON []byte // EventJSON 规范化冻结事件,含业务数据、不含租约秘密。
Applied bool // Applied 该事件是否推进业务视图;旧版本为false但仍可靠保存。
ReceivedAt time.Time // ReceivedAt 数据库UTC受理时间,微秒精度。
}
// TaskView 对应receiver_task_views;这是接收方业务数据,不是Orbit任务权威状态。
type TaskView struct {
ConsumerName string // ConsumerName 与Inbox相同的固定用途。
QueueID string // QueueID 与Inbox相同的绑定队列。
TaskID string // TaskID 原任务标识,业务视图主键的一部分。
LastRevision uint64 // LastRevision 已应用的最大任务版本;0只允许在未提交事务的占位行中。
LastEventID *string // LastEventID 最后推进视图的事件;仅占位状态可为空。
LastState string // LastState 冻结结果状态;NEEDS_REVIEW不能作为成功或最终失败。
ResultJSON []byte // ResultJSON 当前结果,nil表示来源未提供;数值保持精确。
AppliedEvents uint64 // AppliedEvents 实际推进次数,重复及迟到旧版本不增加。
CreatedAt time.Time // CreatedAt 视图首次创建的UTC时间,微秒精度。
UpdatedAt time.Time // UpdatedAt 最后推进的UTC时间,微秒精度。
}