feat: establish Orbit models, migrations and development baseline
This commit is contained in:
34
pulse/model/worker_session.go
Normal file
34
pulse/model/worker_session.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
core "git.yuntuo.hk/k2safe/orbit/model"
|
||||
)
|
||||
|
||||
// WorkerSession 表示一次 Worker 连接的持久化身份与能力快照。
|
||||
// 对应表 pulse_worker_sessions;这是服务端持久化模型,不直接作为 API 响应。
|
||||
type WorkerSession struct {
|
||||
// Record 包含命名空间、记录标识、并发版本和 UTC 时间。
|
||||
core.Record
|
||||
// WorkerInstanceID Worker 进程实例标识,重连保留,进程重启应更换。
|
||||
WorkerInstanceID core.ID `db:"worker_instance_id"`
|
||||
// CredentialID 关联的命名空间凭据标识。
|
||||
CredentialID core.ID `db:"credential_id"`
|
||||
// NodeID 承载当前连接的平台节点标识。
|
||||
NodeID core.ID `db:"node_id"`
|
||||
// SessionEpoch 该 Worker 实例的连接代次,用于隔离旧会话。
|
||||
SessionEpoch uint64 `db:"session_epoch"`
|
||||
// Capabilities 已登记的处理器版本、队列等能力快照。
|
||||
Capabilities core.JSON `db:"capabilities"`
|
||||
// Capacity Worker 声明的执行容量,仍受平台权限和配额约束。
|
||||
Capacity uint32 `db:"capacity"`
|
||||
// CapacitySequence 会话内容量消息序号,重复上报不得重复增加额度。
|
||||
CapacitySequence uint64 `db:"capacity_sequence"`
|
||||
// Draining 是否正在排空连接;排空时不接收新任务。
|
||||
Draining bool `db:"draining"`
|
||||
// ExpiresAt 过期时间,统一 UTC;到期后的行为由对应资源策略决定。
|
||||
ExpiresAt time.Time `db:"expires_at"`
|
||||
}
|
||||
|
||||
func (WorkerSession) TableName() string { return "pulse_worker_sessions" }
|
||||
Reference in New Issue
Block a user