api

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 7 Imported by: 10

Documentation

Index

Constants

View Source
const (
	// EventWorker is the event type for worker-level events.
	EventWorker = "WorkerEvent"

	// EventBridgeWorker is the event type for bridge worker-level events.
	EventBridgeWorker = "BridgeWorkerEvent"

	// EventFunctionWorker is the event type for function worker-level events.
	EventFunctionWorker = "FunctionWorkerEvent"

	// EventLog is the message type carrying one EventLogEntry: a fact delivered
	// from ConfigHub's event log to a subscribed worker. Its Data is an
	// EventLogEntry.
	EventLog = "EventLog"
)

SSE event types

View Source
const MaxActionResultMessageLength = 4096
View Source
const MaxConfigDataLength = 64 * 1024 * 1024 // 64MB
View Source
const MaxProviderTypeLength = 128

Max length for 3P providers

Variables

Functions

func IsSupportedProvider

func IsSupportedProvider(provider ProviderType) bool

func IsValidProviderType

func IsValidProviderType(provider ProviderType) bool

func ValidateActionResultBaseMeta

func ValidateActionResultBaseMeta(arbm *ActionResultBaseMeta) error

func ValidateActionResultData

func ValidateActionResultData(ar *ActionResult) error

func ValidateActionResultMeta

func ValidateActionResultMeta(ar *ActionResult) error

Types

type ActionResult

type ActionResult struct {
	UnitID  uuid.UUID `description:"UUID of the Unit on which the action is performed"`
	SpaceID uuid.UUID `description:"UUID of the Space of the Unit on which the action is performed"`
	// OrganizationID comes from the worker
	// QueuedOperationID links this result back to the original operation request.
	QueuedOperationID uuid.UUID `description:"UUID of the operation corresponding to the action request"`
	ActionResultBaseMeta
	Data []byte `` /* 130-byte string literal not displayed */
	// ErrorMessages contains warning or error messages to surface to the user.
	ErrorMessages []string `json:",omitempty" description:"Warning or error messages to surface to the user"`
}

ActionResult is a result of action from the Bridgeworker

type ActionResultBaseMeta

type ActionResultBaseMeta struct {
	RevisionNum  int64
	Action       ActionType       `bun:",notnull" swaggertype:"string"`
	Result       ActionResultType `bun:",notnull,default:'None'" swaggertype:"string"`
	Status       ActionStatusType `bun:",notnull,default:'None'" swaggertype:"string"`
	Message      string           `bun:"type:text"`
	StartedAt    time.Time        `json:",omitempty" bun:"type:timestamptz"`
	TerminatedAt *time.Time       `json:",omitempty" bun:"type:timestamptz"`
}

type ActionResultType

type ActionResultType string
const (
	ActionResultNone ActionResultType = "None"

	ActionResultFunctionInvocationCompleted ActionResultType = "FunctionInvocationCompleted"
	ActionResultFunctionInvocationFailed    ActionResultType = "FunctionInvocationFailed"
)

Drift values

type ActionStatusType

type ActionStatusType string
const (
	ActionStatusNone        ActionStatusType = "None"
	ActionStatusPending     ActionStatusType = "Pending"
	ActionStatusSubmitted   ActionStatusType = "Submitted"
	ActionStatusProgressing ActionStatusType = "Progressing"
	ActionStatusCompleted   ActionStatusType = "Completed"
	ActionStatusFailed      ActionStatusType = "Failed"
	ActionStatusCanceled    ActionStatusType = "Canceled"
	ActionStatusAborted     ActionStatusType = "Aborted" // Operation superseded by a newer one
)

Status values

type ActionType

type ActionType string
const (
	ActionNA     ActionType = "N/A"
	ActionCancel ActionType = "Cancel"

	// ActionApply is no longer performed — nothing applies configuration since
	// the bridge sunset. The constant remains because historical UnitActions and
	// UnitEvents carry it. It is deliberately absent from ValidAction: it can be
	// read, not submitted.
	ActionApply ActionType = "Apply"

	ActionInvokeFunctions ActionType = "InvokeFunctions"
	ActionListFunctions   ActionType = "ListFunctions"
)

Action values

type EventLogEntry added in v0.1.95

type EventLogEntry struct {
	// CursorID is this event's monotonic position in the log. A consumer that
	// has handled through here resumes after it.
	CursorID int64 `description:"Monotonic cursor of this event in the log."`

	// EventType is the fact's type, for example "release.published".
	EventType string `description:"The event type."`

	// SubjectEntityType is the entity type the event is about, for example
	// "Unit" or "Release".
	SubjectEntityType string `description:"Entity type the event is about."`

	// SubjectEntityID is the id of the entity the event is about.
	SubjectEntityID uuid.UUID `description:"Id of the entity the event is about."`

	// SpaceID is the event's Space scope, if any (UUID string).
	SpaceID string `json:",omitempty" description:"Space scope, if any."`

	// TargetID is the event's Target scope, if any (UUID string).
	TargetID string `json:",omitempty" description:"Target scope, if any."`

	// Payload is the event-type-specific data, opaque to the transport.
	Payload json.RawMessage `json:",omitempty" description:"Event-type-specific payload."`

	// CreatedAt is when the event was emitted.
	CreatedAt time.Time `description:"When the event was emitted."`

	// SubscriptionName is the subscription this event was delivered for.
	SubscriptionName string `description:"The subscription this event was delivered for."`
}

EventLogEntry is one delivered event: a fact from ConfigHub's event log, addressed to no one. It is the Data of an EventMessage whose Event is api.EventLog. A bot reacts to it however it likes; the reaction is the bot's own business and never came from ConfigHub.

type EventMessage

type EventMessage struct {
	Event string
	Data  interface{}
}

type EventSubscription added in v0.1.95

type EventSubscription struct {
	// Name is the stable per-worker subscription name. The server keys the
	// delivery cursor on it, so it must be identical across reconnects for
	// resume to work. A worker with a single subscription uses a constant.
	Name string `` /* 136-byte string literal not displayed */

	// EventTypes are the event types to receive, for example
	// "release.published". Empty means every type.
	EventTypes []string `json:",omitempty" description:"Event types to receive, e.g. \"release.published\". Empty means every type."`

	// SpaceID optionally scopes delivery to one Space (UUID string). Empty means
	// any Space.
	SpaceID string `json:",omitempty" description:"Optional Space scoping filter (UUID). Empty means any Space."`

	// TargetID optionally scopes delivery to one Target (UUID string). Empty
	// means any Target.
	TargetID string `json:",omitempty" description:"Optional Target scoping filter (UUID). Empty means any Target."`

	// FromCursor optionally overrides where delivery begins. When set, delivery
	// starts after this cursor; when unset, delivery resumes from the
	// server-stored bookmark, or from the log tail on a first-ever connect.
	FromCursor *int64 `` /* 173-byte string literal not displayed */
}

EventSubscription is a worker's standing request to receive facts from ConfigHub's event log over the long-poll connection. The worker declares its subscriptions in WorkerInfo at connect time; the server matches the log's scoping columns against the filter and pushes matching events down the same connection it already holds open.

A subscription is a filter, not a queue: ConfigHub keeps no per-message delivery state. It keeps one cursor per (worker, Name) — the bookmark — so a restarted worker resumes where it left off instead of replaying the log or skipping to the present.

type FunctionWorkerEventRequest

type FunctionWorkerEventRequest struct {
	// Action defines the operation the function worker should perform.
	Action ActionType `description:"Action defines the operation the function worker should perform."`

	// Payload contains the data required for the action, primarily the function invocation details.
	Payload FunctionWorkerPayload `description:"Payload contains the data required for the action, primarily the function invocation details."`
}

FunctionWorkerEventRequest encapsulates a request destined for the function worker plugin. It specifies the action to be performed and includes the necessary payload.

type FunctionWorkerInfo

type FunctionWorkerInfo struct {
	ToolchainTypes     []workerapi.ToolchainType                                        `description:"Supported ToolchainTypes"`
	SupportedFunctions map[workerapi.ToolchainType]map[string]funcApi.FunctionSignature `description:"Signatures of supported functions by ToolchainType"`
}

FunctionWorkerInfo is a data-only struct for wire serialization of function worker capabilities. It is generated by FunctionExecutor.Info() or built directly from a signature registry.

type FunctionWorkerPayload

type FunctionWorkerPayload struct {
	// QueuedOperationID is the identifier of the original queued operation request.
	QueuedOperationID uuid.UUID `description:"QueuedOperationID is the identifier of the original queued operation request."`

	// InvocationRequest encapsulates the full request for invoking one or more functions,
	// including context, configuration data, function calls, and execution options.
	// This structure is defined in the functions plugin's API package.
	InvocationRequest funcApi.FunctionInvocationRequest `` /* 175-byte string literal not displayed */
}

FunctionWorkerPayload holds the specific data for a function worker request.

type ProviderType

type ProviderType string

ProviderType says whether and how a Unit is delivered.

const (
	// ProviderConfigHub marks configuration that ConfigHub applies to itself, such as the
	// ConfigHub/YAML Unit that holds an entity's configuration.
	ProviderConfigHub ProviderType = "ConfigHub"
	// ProviderOCI publishes Unit data verbatim in its Space's Releases, which a puller
	// (e.g. Argo CD or Flux) consumes from ConfigHub's OCI registry.
	ProviderOCI ProviderType = "OCI"
	// ProviderNone is used to express the Unit is not in use in a Release
	// or to be applied
	ProviderNone ProviderType = "None"
)

type ResourceInfo

type ResourceInfo struct {
	ResourceName string `` /* 206-byte string literal not displayed */
	ResourceType string `` /* 214-byte string literal not displayed */
}

TODO unify this API with the function API package. This struct is redundant with that of function API.

type WorkerEventRequest

type WorkerEventRequest struct {
	Action  ActionType `description:"The action requested"`
	Payload WorkerPayload
}

type WorkerInfo

type WorkerInfo struct {
	// IsServerWorker says that no worker process is expected to connect: the worker is an
	// identity only, and runs no functions. It is fixed when the worker is created.
	IsServerWorker     bool               `` /* 215-byte string literal not displayed */
	FunctionWorkerInfo FunctionWorkerInfo `description:"FunctionWorker capabilities"`
}

type WorkerPayload

type WorkerPayload struct {
	Timestamp int64 `description:"Time the action was requested"`
}

Jump to

Keyboard shortcuts

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