Help us shape the future of Go! Take the 2026 Go Developer Survey

controlplane

package
v0.98.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const CapabilitySecretOutputs = "secret_outputs"

CapabilitySecretOutputs declares that this runner masks secret node outputs. The control plane refuses a job whose flow declares one to a claim without it.

Variables

View Source
var ErrNoJobAvailable = errors.New("no runner job available")

Functions

func Capabilities added in v0.81.0

func Capabilities() []string

Capabilities lists what this runner build supports, declared on every claim.

func FlowExecutionResultToPayload

func FlowExecutionResultToPayload(result *spi.FlowExecutionResult) (map[string]any, error)

func IsTransient added in v0.70.0

func IsTransient(err error) bool

IsTransient reports whether err is a control-plane failure expected to clear on retry: a 5xx, 429 or 404 status, a network error, or a request deadline. A control plane redeploy produces these for a few seconds; the 404 is the edge answering while it reroutes. Callers escalate one that persists.

Types

type APIErrorResponse

type APIErrorResponse struct {
	Errors []struct {
		Code    string `json:"code"`
		Message string `json:"message"`
	} `json:"errors"`
}

type ClaimNextRequest

type ClaimNextRequest struct {
	RunnerID         string    `json:"runner_id"`
	BootID           uuid.UUID `json:"boot_id"`
	MaxParallelFlows int       `json:"max_parallel_flows"`
}

type ClaimedJob

type ClaimedJob struct {
	JobID           uuid.UUID                      `json:"job_id"`
	ExecutionID     uuid.UUID                      `json:"execution_id"`
	FlowID          uuid.UUID                      `json:"flow_id"`
	LeaseExpiresAt  time.Time                      `json:"lease_expires_at"`
	FlowDefinition  json.RawMessage                `json:"flow_definition"`
	Inputs          map[string]any                 `json:"inputs"`
	SecretInputKeys []string                       `json:"secret_input_keys,omitempty"`
	ReferencedFlows flowpkg.ReferencedFlowRegistry `json:"referenced_flows,omitempty"`
	// JobToken is set by a self-hosted claim. A one-shot Job gets it from its own claim.
	JobToken string `json:"job_token,omitempty"`
	// MaxHTTPCallsPerExecution is the organization's HTTP call limit. Zero, from a
	// control plane that does not send it, records calls without a limit.
	MaxHTTPCallsPerExecution int `json:"max_http_calls_per_execution,omitempty"`
}

func (*ClaimedJob) UnmarshalJSON

func (j *ClaimedJob) UnmarshalJSON(data []byte) error

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewJobClient added in v0.52.0

func NewJobClient(baseURL, jobToken string, timeout time.Duration) *Client

func NewRunnerClient added in v0.52.0

func NewRunnerClient(config Config) *Client

func (*Client) ClaimNext

func (c *Client) ClaimNext(ctx context.Context, request ClaimNextRequest) (*ClaimedJob, error)

func (*Client) Complete

func (c *Client) Complete(ctx context.Context, jobID uuid.UUID, request CompleteJobRequest) error

func (*Client) Heartbeat

func (c *Client) Heartbeat(ctx context.Context, request HeartbeatRequest) ([]HeartbeatResult, error)

func (*Client) SendJobEvents

func (c *Client) SendJobEvents(
	ctx context.Context,
	jobID uuid.UUID,
	request SendJobEventsRequest,
) (*SendJobEventsResponse, error)

type CompleteJobRequest

type CompleteJobRequest struct {
	RunnerID          string          `json:"runner_id"`
	BootID            uuid.UUID       `json:"boot_id"`
	Status            string          `json:"status"`
	StartedAt         time.Time       `json:"started_at"`
	CompletedAt       time.Time       `json:"completed_at"`
	DurationMs        int64           `json:"duration_ms"`
	Result            *map[string]any `json:"result,omitempty"`
	ErrorMessage      *string         `json:"error_message,omitempty"`
	ErrorCode         *string         `json:"error_code,omitempty"`
	LastEventSequence *int64          `json:"last_event_sequence,omitempty"`
}

type Config

type Config struct {
	BaseURL        string
	OrganizationID string
	RunnerAPIKey   string
	RequestTimeout time.Duration
}

type HeartbeatRequest

type HeartbeatRequest struct {
	RunnerID         string      `json:"runner_id"`
	BootID           uuid.UUID   `json:"boot_id"`
	MaxParallelFlows int         `json:"max_parallel_flows"`
	JobIDs           []uuid.UUID `json:"job_ids"`
}

type HeartbeatResult

type HeartbeatResult struct {
	JobID          uuid.UUID  `json:"job_id"`
	Status         string     `json:"status"`
	LeaseExpiresAt *time.Time `json:"lease_expires_at"`
}

type RunnerProgressEvent

type RunnerProgressEvent struct {
	Sequence int64         `json:"sequence"`
	Type     spi.EventType `json:"type"`
	// Payload is the event-type-specific body, marshalled as a JSON object.
	// It is a typed struct at the call site (see internal/runtime payloads).
	Payload any `json:"payload"`
}

type SendJobEventsRequest

type SendJobEventsRequest struct {
	RunnerID string                `json:"runner_id"`
	BootID   uuid.UUID             `json:"boot_id"`
	Events   []RunnerProgressEvent `json:"events"`
}

type SendJobEventsResponse

type SendJobEventsResponse struct {
	LastAcceptedSequence int64 `json:"last_accepted_sequence"`
}

type StatusError added in v0.70.0

type StatusError struct {
	StatusCode int
	Detail     string
}

StatusError is a non-success HTTP status returned by the control plane.

func (*StatusError) Error added in v0.70.0

func (e *StatusError) Error() string

Jump to

Keyboard shortcuts

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