controlplane

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func FlowExecutionResultToPayload

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

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"`
	ReferencedFlows flowpkg.ReferencedFlowRegistry `json:"referenced_flows,omitempty"`
}

func (*ClaimedJob) UnmarshalJSON

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

type Client

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

func NewClient

func NewClient(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"`
}

Jump to

Keyboard shortcuts

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