feat: establish Orbit models, migrations and development baseline

This commit is contained in:
2026-09-17 07:04:21 +08:00
commit 4f2935e36f
84 changed files with 4915 additions and 0 deletions

36
weave/model/poll_state.go Normal file
View File

@@ -0,0 +1,36 @@
package model
import (
"time"
core "git.yuntuo.hk/k2safe/orbit/model"
)
// PollState 表示有界查询节点的持久化预算与恢复检查点。
// 对应表 weave_poll_states;这是服务端持久化模型,不直接作为 API 响应。
type PollState struct {
// Record 包含命名空间、记录标识、并发版本和 UTC 时间。
core.Record
// WorkflowID 所属流程实例标识。
WorkflowID core.ID `db:"workflow_id"`
// ActivationID 所属步骤激活,区分旧轮次和人工恢复后的新轮次。
ActivationID core.ID `db:"activation_id"`
// MaxRounds 业务查询最多轮次,不等于单轮请求重试次数。
MaxRounds uint32 `db:"max_rounds"`
// UsedRounds 已创建的查询轮次,重启或暂停继续不得重置。
UsedRounds uint32 `db:"used_rounds"`
// MaxAttemptsPerRound 每轮 Pulse 任务最多尝试数,包含该轮首次请求。
MaxAttemptsPerRound uint32 `db:"max_attempts_per_round"`
// IntervalMS 相邻业务查询轮次的等待间隔,单位毫秒。
IntervalMS uint64 `db:"interval_ms"`
// DeadlineAt 查询节点总截止时间,轮次和单轮重试都受此边界限制。
DeadlineAt time.Time `db:"deadline_at"`
// NextPollAt 最早允许下一轮查询的时间;为空表示当前不能直接推进。
NextPollAt *time.Time `db:"next_poll_at"`
// CurrentTaskID 当前在途查询任务;非空时禁止重叠开启下一轮;可为空,表示尚未设置该关联或值。
CurrentTaskID *core.ID `db:"current_task_id"`
// ResolvedAt 等待或查询节点结清的时间;尚未结清时为空。
ResolvedAt *time.Time `db:"resolved_at"`
}
func (PollState) TableName() string { return "weave_poll_states" }