workerproto

package
v1.2.10-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRegisterPath  = "/v1/workers/register"
	DefaultHeartbeatPath = "/v1/workers/heartbeat"
	DefaultPullPath      = "/v1/workers/pull"
	DefaultCompletePath  = "/v1/workers/complete"
	DefaultExecutePath   = "/v1/worker/execute"
	DefaultPollPath      = "/v1/worker/poll"
	DefaultCancelPath    = "/v1/worker/cancel"
	ProtocolHeader       = "X-Workflow-Protocol-Version"
	ProtocolVersion      = "1"
	DurationUnit         = "nanosecond"
	TimestampFormat      = "RFC3339Nano"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelRequest

type CancelRequest struct {
	Task           executor.ExecuteTask `json:"task"`
	ExternalTaskID string               `json:"external_task_id"`
}

type CancelResponse

type CancelResponse struct {
	Cancelled bool   `json:"cancelled"`
	Message   string `json:"message,omitempty"`
}

type Command added in v1.2.11

type Command struct {
	CommandID      string               `json:"command_id"`
	Operation      Operation            `json:"operation"`
	Task           executor.ExecuteTask `json:"task"`
	ExternalTaskID string               `json:"external_task_id,omitempty"`
	Delivery       int                  `json:"delivery"`
}

Command is a leased scheduler-to-worker operation. CommandID identifies the delivery, while Task.DispatchID identifies the underlying execution attempt.

type CompleteRequest added in v1.2.11

type CompleteRequest struct {
	WorkerID  string                  `json:"worker_id"`
	CommandID string                  `json:"command_id"`
	Result    *executor.ExecuteResult `json:"result,omitempty"`
	Cancelled bool                    `json:"cancelled,omitempty"`
	Error     string                  `json:"error,omitempty"`
}

type CompleteResponse added in v1.2.11

type CompleteResponse struct {
	Accepted bool `json:"accepted"`
}

type ErrorCode added in v1.2.11

type ErrorCode string
const (
	ErrorInvalidJSON          ErrorCode = "invalid_json"
	ErrorInvalidRequest       ErrorCode = "invalid_request"
	ErrorWorkerUnavailable    ErrorCode = "worker_unavailable"
	ErrorExecutorNotFound     ErrorCode = "executor_not_found"
	ErrorUnsupportedOperation ErrorCode = "unsupported_operation"
	ErrorProtocolVersion      ErrorCode = "unsupported_protocol_version"
	ErrorInternal             ErrorCode = "internal_error"
)

type ErrorResponse added in v1.2.11

type ErrorResponse struct {
	Error     string    `json:"error"`
	Code      ErrorCode `json:"code"`
	Retryable bool      `json:"retryable,omitempty"`
}

ErrorResponse is reserved for protocol and transport failures. Executor failures are represented by ExecuteResult with an HTTP 200 response.

type ExecuteRequest

type ExecuteRequest struct {
	Task executor.ExecuteTask `json:"task"`
}

type ExecuteResponse

type ExecuteResponse struct {
	Result executor.ExecuteResult `json:"result"`
}

type HeartbeatRequest

type HeartbeatRequest struct {
	WorkerID string `json:"worker_id"`
}

type Operation added in v1.2.11

type Operation string
const (
	OperationExecute Operation = "execute"
	OperationPoll    Operation = "poll"
	OperationCancel  Operation = "cancel"
)

type PollRequest

type PollRequest struct {
	Task           executor.ExecuteTask `json:"task"`
	ExternalTaskID string               `json:"external_task_id"`
}

type PollResponse

type PollResponse struct {
	Result executor.ExecuteResult `json:"result"`
}

type ProtocolInfo added in v1.2.11

type ProtocolInfo struct {
	Version         string      `json:"version"`
	DurationUnit    string      `json:"duration_unit"`
	TimestampFormat string      `json:"timestamp_format"`
	Transports      []Transport `json:"transports"`
	Operations      []Operation `json:"operations"`
}

func CurrentProtocolInfo added in v1.2.11

func CurrentProtocolInfo() ProtocolInfo

type PullRequest added in v1.2.11

type PullRequest struct {
	WorkerID string `json:"worker_id"`
}

type PullResponse added in v1.2.11

type PullResponse struct {
	Command *Command `json:"command,omitempty"`
}

type RegisterRequest

type RegisterRequest struct {
	Worker WorkerDescriptor `json:"worker"`
}

type RegisterResponse

type RegisterResponse struct {
	Accepted bool   `json:"accepted"`
	Message  string `json:"message,omitempty"`
}

type Status

type Status string
const (
	StatusOnline  Status = "online"
	StatusOffline Status = "offline"
	StatusBusy    Status = "busy"
)

type Transport added in v1.2.11

type Transport string
const (
	TransportCallback Transport = "callback"
	TransportPull     Transport = "pull"
)

type WorkerDescriptor

type WorkerDescriptor struct {
	ID                     string            `json:"id"`
	Name                   string            `json:"name,omitempty"`
	Tenant                 string            `json:"tenant,omitempty"`
	Endpoint               string            `json:"endpoint"`
	Transport              Transport         `json:"transport,omitempty"`
	ProtocolVersion        string            `json:"protocol_version,omitempty"`
	Status                 Status            `json:"status"`
	Weight                 int               `json:"weight,omitempty"`
	MaxConcurrent          int               `json:"max_concurrent,omitempty"`
	CurrentTasks           int               `json:"current_tasks,omitempty"`
	SupportedExecutorTypes []string          `json:"supported_executor_types,omitempty"`
	SupportedExecutorRefs  []string          `json:"supported_executor_refs,omitempty"`
	Labels                 map[string]string `json:"labels,omitempty"`
	LastHeartbeatAt        time.Time         `json:"last_heartbeat_at,omitempty,omitzero"`
}

Jump to

Keyboard shortcuts

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