workerpull

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 4 Imported by: 0

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"`
	PublishedAt time.Time `json:"publishedAt"`
}

PublishedWorkflowHead 是一个已发布 workflow 版本的轻量摘要。

type ServiceScope

type ServiceScope struct {
	Env       string `json:"env" yaml:"env"`
	Workspace string `json:"workspace" yaml:"workspace"`
}

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) Validate

func (s ServiceScope) Validate() error

Validate 校验 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"`
}

WorkerBootstrapRequest 是 worker 拉取发布清单的请求。

type WorkerPublishedWorkflowRequest

type WorkerPublishedWorkflowRequest struct {
	Env        string `json:"env"`
	Workspace  string `json:"workspace"`
	WorkflowID string `json:"workflowId"`
	Version    string `json:"version"`
}

WorkerPublishedWorkflowRequest 是 worker 拉取完整发布 workflow 的请求。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL