Files
orbit/pulse/model/queue.go

36 lines
1.7 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 (
core "git.yuntuo.hk/k2safe/orbit/model"
"time"
)
// Queue 表示任务路由与资源控制队列,不要求每个租户单独创建队列。
// 对应表 pulse_queues;这是服务端持久化模型,不直接作为 API 响应。
type Queue struct {
// Record 包含命名空间、记录标识、并发版本和 UTC 时间。
core.Record
// RetiredAt 永久退役的UTC时间;空表示未退役,退役后保留历史且禁止新工作。
RetiredAt *time.Time `db:"retired_at"`
// Name 可读名称,唯一性范围由对应数据表约束。
Name string `db:"name"`
// Paused 暂停标记;停止新的受控工作,不表示在途请求已停止。
Paused bool `db:"paused"`
// MaxConcurrency 允许同时持有的有效执行许可上限,必须大于零。
MaxConcurrency uint32 `db:"max_concurrency"`
// RatePerSecond 每个数据库一秒窗口最多提交的开始授权数,由所有节点共享。
RatePerSecond uint32 `db:"rate_per_second"`
// MaxUnfinishedTasks 未终结任务数上限;降额不删除或终止已受理任务。
MaxUnfinishedTasks uint32 `db:"max_unfinished_tasks"`
// UnfinishedTasks 等待、预占、运行及待核查的任务总数,首次终结时同事务减一。
UnfinishedTasks uint64 `db:"unfinished_tasks"`
// StartWindowUntil 当前一秒计数窗口结束时刻,空表示尚无开始授权。
StartWindowUntil *time.Time `db:"start_window_until"`
// StartsInWindow 当前窗口的开始授权次数,重复确认不计数,调整配置不清零。
StartsInWindow uint32 `db:"starts_in_window"`
// Policy 队列资源与执行配置的 JSON 文档。
Policy core.JSON `db:"policy"`
}
func (Queue) TableName() string { return "pulse_queues" }