Documentation
¶
Index ¶
- Constants
- func AcceptsProtocolVersion(version string) bool
- func SupportsExecuteReplay(version string) bool
- func SupportsPullTransport(version string) bool
- type CancelRequest
- type CancelResponse
- type Command
- type CompleteRequest
- type CompleteResponse
- type ErrorCode
- type ErrorResponse
- type ExecuteRequest
- type ExecuteResponse
- type HeartbeatRequest
- type Operation
- type PollRequest
- type PollResponse
- type ProtocolInfo
- type PullRequest
- type PullResponse
- type RegisterRequest
- type RegisterResponse
- type Status
- type Transport
- type WorkerDescriptor
Constants ¶
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 ¶
func AcceptsProtocolVersion ¶ added in v1.2.11
AcceptsProtocolVersion reports whether the current runtime can decode a protocol version. Empty identifies the versionless callback compatibility bridge; it must not be interpreted as support for v1 behavior.
func SupportsExecuteReplay ¶ added in v1.2.11
SupportsExecuteReplay reports whether the protocol guarantees that replaying Execute with the same dispatch_id does not invoke user code twice.
func SupportsPullTransport ¶ added in v1.2.11
SupportsPullTransport reports whether the protocol implements leased command delivery and idempotent completion.
Types ¶
type CancelRequest ¶
type CancelRequest struct {
Task executor.ExecuteTask `json:"task"`
ExternalTaskID string `json:"external_task_id"`
}
type CancelResponse ¶
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 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" 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 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 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"`
}