workload

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package workload resolves a service-owned declarative release against platform-owned capabilities. A manifest is data, never Go, shell, an executor ID or a credential.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind

func Bind(raw []byte, p Policy, steps map[Capability][]workflow.Step) ([]workflow.Step, error)

Bind maps declared operations to reviewed executors or workflow calls. The caller injects mandatory source/plan/approval BEFORE the resulting apply sequence.

Types

type Call

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

Call is a logical invocation, independent of worker placement. It carries its tenant even when the worker calls another worker. There is no override argument.

func (Call) Call

func (c Call) Call(op Capability) (Call, error)

Call invokes another worker under the same tenant and its own operation grant.

func (Call) Operation

func (c Call) Operation() Capability

func (Call) Params

func (c Call) Params() (map[string]string, error)

Params returns fresh dispatch hints for this call, including calls made at runtime by shared workers. Never pass arbitrary job input through instead.

func (Call) Step

func (c Call) Step(id string) Step

func (Call) Tenant

func (c Call) Tenant() TenantID

type Capability

type Capability string
const (
	GetState       Capability = "get_state"
	RecordSuccess  Capability = "record_success"
	SourceFetch    Capability = "source_fetch"
	WorkflowDeploy Capability = "workflow_deploy"
)
const (
	LXC     Capability = "deploy_lxc"
	Compose Capability = "deploy_compose"
	Docker  Capability = "deploy_docker"
	Native  Capability = "deploy_native"
	Routes  Capability = "route_deploy"
	// OIDC provisions the service's identity-provider client before its
	// application step. Version 2 (tenant) releases only.
	OIDC Capability = "oidc_client"
)

type Declaration

type Declaration struct {
	Version int          `json:"version"`
	Service string       `json:"service"`
	Steps   []Capability `json:"steps"`
}

Declaration is the repository-owned, target-free v2 service manifest. Platform-owned source, plan, approval and verification cannot be supplied or removed by this document.

func NewDeclaration

func NewDeclaration(service string, steps ...Capability) (Declaration, error)

type EntryKey

type EntryKey struct {
	RepositoryID uint64
	Entry        string
}

EntryKey identifies a registered release entry for a verified source repository. The runtime adapter obtains both fields from authoritative records, never job data.

type Policy

type Policy struct {
	Service, Target string
	Allowed         []Capability
}

Policy is set by arch, not the service. Only known hosts and capabilities may bind.

type Registration

type Registration struct {
	EntryKey
	PipelineID, Environment, Service string
	Grants                           []Capability
}

Registration is platform-owned. PipelineID and Environment are immutable logical identity components; neither an executor, event ID, release SHA nor job ID belongs here.

type Registry

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

Registry is an immutable snapshot. Instantiate once for all pipeline environments.

func NewRegistry

func NewRegistry(registrations ...Registration) (Registry, error)

func (Registry) Admit

func (r Registry) Admit(verified EntryKey) (TenantContext, error)

Admit looks up a verified release entry. This is policy lookup, not OIDC verification.

func (Registry) Authorize

func (r Registry) Authorize(verified EntryKey, expected Capability, hints map[string]string) (Call, error)

Authorize checks the hints on a concrete graph edge against trusted job ancestry and the receiving worker's configured operation. A direct start (no verified entry), foreign tenant, ungranted operation or relabelled edge returns no call. The adapter must verify the actual invoking graph/node as well as the entry; this library does not authenticate xyOps job records.

type Release

type Release struct {
	Version int          `json:"version"`
	Service string       `json:"service"`
	Target  string       `json:"target"`
	Steps   []Capability `json:"steps"`
}

func Parse

func Parse(raw []byte, p Policy) (Release, error)

type Step

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

Step is either a checked application worker call or a local orchestration step. Worker event references are resolved only when lowering to xyOps.

func Local

func Local(s workflow.Step) Step

Local inserts reviewed tasks, gates and approvals. Use a checked Call for event references.

type TenantContext

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

TenantContext can only be obtained from an admitted registration or inherited from a call. It is not a serializable bearer credential.

func (TenantContext) BindRelease

func (t TenantContext) BindRelease(raw []byte) ([]Step, error)

BindRelease admits the portable v2 service manifest, which has no target, tenant, worker IDs, state paths or credentials. Source verification and plan/approval are still the caller's responsibility. As with legacy Bind, an invalid release returns no partial steps.

func (TenantContext) Call

func (t TenantContext) Call(op Capability) (Call, error)

func (TenantContext) ID

func (t TenantContext) ID() TenantID

func (TenantContext) NewPipeline

func (t TenantContext) NewPipeline(s *core.Stack, name string, p workflow.PipelineProps, workers Workers, graph ...Step) (*workflow.Pipeline, error)

NewPipeline compiles graph steps under one admitted tenant. It refuses foreign calls, unbound events and legacy/unscoped steps before creating any resources.

func (TenantContext) NewReleaseEntry

func (t TenantContext) NewReleaseEntry(s *core.Stack, p workflow.EntryProps) (*workflow.Pipeline, error)

NewReleaseEntry builds the usual success-only definitions -> body admission graph. Both edges carry the admitted tenant; the installer requires its own grant.

type TenantID

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

TenantID is a comparable, portable key for platform resource and state lookup. Its zero value is not a tenant. Identifiers are validated before admission.

func (TenantID) Environment

func (t TenantID) Environment() string

func (TenantID) PipelineID

func (t TenantID) PipelineID() string

func (TenantID) String

func (t TenantID) String() string

type Workers

type Workers map[Capability]xyops.EventRef

Workers is the reviewed, site-specific operation dispatch table. Relocating a worker does not change a tenant, a release, or the logical call graph.

Jump to

Keyboard shortcuts

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