feat: establish Orbit models, migrations and development baseline
This commit is contained in:
34
weave/model/inbox_event.go
Normal file
34
weave/model/inbox_event.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
core "git.yuntuo.hk/k2safe/orbit/model"
|
||||
)
|
||||
|
||||
// InboxEvent 表示Weave 内部事件消费记录,和流程推进一起确认消费。
|
||||
// 对应表 weave_inbox;这是服务端持久化模型,不直接作为 API 响应。
|
||||
type InboxEvent struct {
|
||||
// Record 包含命名空间、记录标识、并发版本和 UTC 时间。
|
||||
core.Record
|
||||
// WorkflowID 所属流程实例标识。
|
||||
WorkflowID core.ID `db:"workflow_id"`
|
||||
// EventID 来源持久化事件标识,用于消费去重。
|
||||
EventID core.ID `db:"event_id"`
|
||||
// State 当前状态;只允许定义的状态转换并配合事务校验。
|
||||
State InboxState `db:"state"`
|
||||
// AvailableAt 最早可被领取或处理的时间,统一 UTC。
|
||||
AvailableAt time.Time `db:"available_at"`
|
||||
// LeaseOwner 租约持有者标识;未持有租约时为空。
|
||||
LeaseOwner *core.ID `db:"lease_owner"`
|
||||
// LeaseEpoch 递增的执行或消费代次,用于隔离旧授权。
|
||||
LeaseEpoch uint64 `db:"lease_epoch"`
|
||||
// LeaseUntil 内部消费租约截止时间;没有消费租约时为空。
|
||||
LeaseUntil *time.Time `db:"lease_until"`
|
||||
// ProcessedAt 内部事件完成消费的时间;尚未消费时为空。
|
||||
ProcessedAt *time.Time `db:"processed_at"`
|
||||
// ErrorCode 稳定错误分类,供恢复策略判断;不得写入敏感原始错误;可为空,表示尚未设置该关联或值。
|
||||
ErrorCode *string `db:"error_code"`
|
||||
}
|
||||
|
||||
func (InboxEvent) TableName() string { return "weave_inbox" }
|
||||
Reference in New Issue
Block a user