workercapability

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 6 Imported by: 9

Documentation

Overview

Package workercapability 定义 worker 节点能力上报和控制台目录读取协议。

Index

Constants

View Source
const (
	ReportPath             = "/worker/v1/node-capabilities/report"
	CatalogPath            = "/api/v1/node-capabilities"
	DefaultProtocolVersion = "1"
)

Variables

View Source
var (
	ErrWorkspaceRequired       = errors.New("worker capability workspace is required")
	ErrEnvironmentRequired     = errors.New("worker capability env is required")
	ErrWorkerVersionRequired   = errors.New("worker capability worker version is required")
	ErrProtocolVersionRequired = errors.New("worker capability protocol version is required")
	ErrReportedAtRequired      = errors.New("worker capability reported time is required")
	ErrNodeTypeRequired        = errors.New("worker capability node type is required")
	ErrNodeTypeDuplicated      = errors.New("worker capability node type is duplicated")
)

Functions

This section is empty.

Types

type CatalogRequest

type CatalogRequest struct {
	Workspace string `json:"workspace"`
	Env       string `json:"env"`
	Service   string `json:"service"`
}

CatalogRequest 是 Admin 或前端按服务范围查询节点目录时使用的请求体。

type CatalogResponse

type CatalogResponse struct {
	Items    []Snapshot `json:"items"`
	Services []string   `json:"services"`
}

CatalogResponse 是节点目录及当前范围可选业务服务的响应体。

type ReportRequest

type ReportRequest = Snapshot

ReportRequest 是 worker 上报节点能力时使用的请求体。

type Snapshot

type Snapshot struct {
	Workspace       string          `json:"workspace"`
	Env             string          `json:"env"`
	Service         string          `json:"service"`
	WorkerVersion   string          `json:"workerVersion"`
	InstanceID      string          `json:"instanceId,omitempty"`
	ProtocolVersion string          `json:"protocolVersion"`
	Nodes           []node.Metadata `json:"nodes"`
	ContainerKinds  []string        `json:"containerKinds"`
	ReportedAt      time.Time       `json:"reportedAt"`
}

Snapshot 是一个 worker 版本在指定服务范围内上报的节点能力快照。

func (Snapshot) Normalize

func (s Snapshot) Normalize() Snapshot

Normalize 返回不修改原值的规范化快照副本。

func (Snapshot) Validate

func (s Snapshot) Validate() error

Validate 校验能力快照是否具备缓存和版本匹配所需的稳定身份。

Jump to

Keyboard shortcuts

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