feat: add durable Worker execution and WSS server
This commit is contained in:
25
pulse/model/worker_instance.go
Normal file
25
pulse/model/worker_instance.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package model
|
||||
|
||||
import core "git.yuntuo.hk/k2safe/orbit/model"
|
||||
|
||||
// WorkerInstance 保存进程实例的持久化会话头;重连推进代次,不能仅凭实例 ID 接管。
|
||||
type WorkerInstance struct {
|
||||
// Record 包含命名空间、标识、并发版本与 UTC 时间。
|
||||
core.Record
|
||||
// CredentialID 初次注册的凭据,当前进程生命周期内不可替换。
|
||||
CredentialID core.ID `db:"credential_id"`
|
||||
// QueueID 进程绑定的消费队列;切换队列应创建新实例。
|
||||
QueueID core.ID `db:"queue_id"`
|
||||
// SecretDigest 进程持有的随机恢复秘密摘要;知道实例 ID 不构成恢复授权。
|
||||
SecretDigest core.Digest `db:"secret_digest"`
|
||||
// RegistrationDigest 队列与处理器版本集合的摘要,重连不得改变注册语义。
|
||||
RegistrationDigest core.Digest `db:"registration_digest"`
|
||||
// SessionEpoch 已分配的最大连接代次,初始为零,重连递增。
|
||||
SessionEpoch uint64 `db:"session_epoch"`
|
||||
// CurrentSessionID 当前连接;注册事务创建会话之前为空。
|
||||
CurrentSessionID *core.ID `db:"current_session_id"`
|
||||
// Draining 持久化排空意图,重连保留;排空后不再给该进程新工作。
|
||||
Draining bool `db:"draining"`
|
||||
}
|
||||
|
||||
func (WorkerInstance) TableName() string { return "pulse_worker_instances" }
|
||||
Reference in New Issue
Block a user