Files
orbit/weave/model/poll_state.go

41 lines
2.1 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"
)
// 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 从首次激活起已创建的业务轮次数;当前激活的本地行数需扣除FirstRound之前的历史。
UsedRounds uint32 `db:"used_rounds"`
// FirstRound 本激活保存的首个业务查询轮次;恢复保留原编号,之前轮次仍留在旧激活。
FirstRound uint32 `db:"first_round"`
// FirstRoundAttemptsUsed 首个业务轮次在旧激活已用的执行尝试;从原单轮预算扣除,不能通过换激活重置。
FirstRoundAttemptsUsed uint32 `db:"first_round_attempts_used"`
// 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" }