Documentation
¶
Overview ¶
Package workerpull 定义业务 worker 从控制面拉取已发布 workflow 的轻量协议。
plan client 和 admin worker API 共用这里的请求、响应、scope 和 endpoint 常量。
Index ¶
Constants ¶
View Source
const ( // BootstrapPath 是 worker 拉取发布 workflow 清单的路径。 BootstrapPath = "/worker/v1/workflow-bootstrap" // PublishedPath 是 worker 拉取完整发布 workflow 定义的路径。 PublishedPath = "/worker/v1/workflow-published" )
Variables ¶
View Source
var ErrScopeRequired = errors.New("worker scope is required")
ErrScopeRequired 表示 worker 请求缺少服务范围。
Functions ¶
This section is empty.
Types ¶
type PublishedWorkflowHead ¶
type PublishedWorkflowHead struct {
WorkflowID string `json:"workflowId"`
Version string `json:"version"`
Env string `json:"env"`
Workspace string `json:"workspace"`
Service string `json:"service"`
PublishedAt time.Time `json:"publishedAt"`
}
PublishedWorkflowHead 是一个已发布 workflow 版本的轻量摘要。
type ServiceScope ¶
type ServiceScope struct {
Env string `json:"env" yaml:"env"`
Workspace string `json:"workspace" yaml:"workspace"`
Service string `json:"service" yaml:"service"`
}
ServiceScope 描述业务 worker 拉取 workflow 时使用的环境、空间和业务服务范围。
func (ServiceScope) ApplyEnvelope ¶
func (s ServiceScope) ApplyEnvelope(envelope *core.Envelope) *core.Envelope
ApplyEnvelope 将 scope 信息补入执行入口 envelope。
func (ServiceScope) MatchWorkflow ¶
func (s ServiceScope) MatchWorkflow(workflow *core.Workflow) error
MatchWorkflow 校验 workflow 是否属于该 scope。
func (ServiceScope) Normalize ¶ added in v0.2.0
func (s ServiceScope) Normalize() ServiceScope
Normalize 返回补齐历史默认服务后的 scope 副本。
type WorkerBootstrap ¶
type WorkerBootstrap struct {
Scope ServiceScope `json:"scope"`
Workflows []*PublishedWorkflowHead `json:"workflows"`
}
WorkerBootstrap 是控制面返回给 worker 的发布 workflow 清单。
type WorkerBootstrapRequest ¶
type WorkerBootstrapRequest struct {
Env string `json:"env"`
Workspace string `json:"workspace"`
Service string `json:"service"`
}
WorkerBootstrapRequest 是 worker 拉取发布清单的请求。
type WorkerPublishedWorkflowRequest ¶
type WorkerPublishedWorkflowRequest struct {
Env string `json:"env"`
Workspace string `json:"workspace"`
Service string `json:"service"`
WorkflowID string `json:"workflowId"`
Version string `json:"version"`
}
WorkerPublishedWorkflowRequest 是 worker 拉取完整发布 workflow 的请求。
Click to show internal directories.
Click to hide internal directories.