platform

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package platform provides optional multi-Deployment catalog, routing, and governance capabilities above the Agent Engine.

Catalog snapshots contain exact immutable Deployment bindings and implement agent.DeploymentResolver without owning Process lifecycle. Mutable deployment commands and routing policy build on these snapshots; application persistence, product policy, and observation backends remain outside this package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCatalog = errors.New("platform: invalid deployment catalog")

	ErrDeploymentNotFound = errors.New("platform: deployment not found")
)
View Source
var (
	ErrNilPlatform = errors.New("platform: nil platform")

	ErrDeploymentConflict = errors.New("platform: deployment conflict")

	ErrDeploymentNotActive = errors.New("platform: deployment is not active")
)
View Source
var (
	ErrNilDeploymentSelector = errors.New("platform: nil deployment selector")

	ErrNoDeploymentCandidates = errors.New("platform: no deployment candidates")

	ErrInvalidDeploymentSelection = errors.New("platform: invalid deployment selection")
)

Functions

This section is empty.

Types

type Catalog

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

Catalog is an immutable snapshot of exact Deployment bindings. It contains no active route, mutable registry, Process ownership, or remote discovery. The zero value is an empty catalog. Catalog values are safe for concurrent lookup and enumeration.

func NewCatalog

func NewCatalog(deployments ...agent.Deployment) (Catalog, error)

func (Catalog) Deployments

func (c Catalog) Deployments() []agent.Deployment

Deployments returns all exact bindings in stable Definition-name and Deployment-digest order. The returned slice is independently owned and may be modified by the caller.

func (Catalog) Resolve

func (c Catalog) Resolve(reference agent.DeploymentRef) (agent.Deployment, error)

Resolve returns the Deployment bound to one exact reference. It performs no routing or name fallback and satisfies agent.DeploymentResolver.

type DeploymentCandidate

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

DeploymentCandidate is one non-executable active binding offered to a DeploymentSelector. It exposes the exact identity and static Definition contract, never Dispatcher or Process lifecycle capabilities.

func (DeploymentCandidate) DeploymentRef

func (d DeploymentCandidate) DeploymentRef() agent.DeploymentRef

DeploymentRef returns the candidate's exact immutable Deployment identity.

func (DeploymentCandidate) Descriptor

func (d DeploymentCandidate) Descriptor() agent.Descriptor

Descriptor returns the candidate's frozen static Definition contract.

type DeploymentConflictError

type DeploymentConflictError struct {
	// Active is the exact binding currently occupying the name slot.
	Active agent.DeploymentRef

	// Requested is the exact binding the caller attempted to deploy or undeploy.
	Requested agent.DeploymentRef
}

DeploymentConflictError identifies the active and requested exact bindings that collided in one Definition-name slot.

func (*DeploymentConflictError) Error

func (d *DeploymentConflictError) Error() string

func (*DeploymentConflictError) Unwrap

func (*DeploymentConflictError) Unwrap() error

type DeploymentSelector

type DeploymentSelector interface {
	// Select chooses exactly one DeploymentRef from the detached candidate slice
	// supplied for this call. It may perform caller-owned I/O, must honor ctx, and
	// must be concurrency-safe when shared. Invalid or unoffered references are
	// rejected by Platform after the call returns.
	Select(ctx context.Context, candidates []DeploymentCandidate) (agent.DeploymentRef, error)
}

DeploymentSelector chooses one exact reference from a stable active candidate snapshot. Implementations may perform external I/O, must honor ctx, and must be safe for concurrent calls when shared. Request-specific routing input belongs to the implementation rather than a Framework payload type.

type DeploymentSelectorFunc

type DeploymentSelectorFunc func(
	ctx context.Context,
	candidates []DeploymentCandidate,
) (agent.DeploymentRef, error)

func (DeploymentSelectorFunc) Select

type Platform

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

Platform owns atomic deployment changes, active name slots, and an exact historical Catalog above Engine. It does not own Process lifecycle or Host persistence. Its zero value is an empty usable Platform. A Platform must not be copied after first use.

func New

func New(deployments ...agent.Deployment) (*Platform, error)

func (*Platform) Catalog

func (p *Platform) Catalog() Catalog

Catalog returns the current immutable exact binding snapshot. Historical Deployments remain present after Replace and Undeploy.

func (*Platform) Deploy

func (p *Platform) Deploy(deployment agent.Deployment) error

Deploy activates deployment in its Definition-name slot. Reapplying the exact active binding leaves the Platform unchanged; a different exact binding in the same slot returns ErrDeploymentConflict and requires Replace.

func (*Platform) DeploymentCandidates

func (p *Platform) DeploymentCandidates() []DeploymentCandidate

DeploymentCandidates returns a stable snapshot of active, non-executable candidates. Replaced, undeployed, and other historical Catalog bindings are intentionally excluded. The returned slice is independently owned.

func (*Platform) Replace

func (p *Platform) Replace(deployment agent.Deployment) error

Replace changes the active exact binding in deployment's existing name slot. The previous binding remains in Catalog for exact restoration.

func (*Platform) Resolve

func (p *Platform) Resolve(reference agent.DeploymentRef) (agent.Deployment, error)

Resolve performs one exact lookup against the current immutable Catalog and satisfies agent.DeploymentResolver. Inactive historical bindings remain resolvable so Process restoration never follows an active route by mistake.

func (*Platform) SelectDeployment

func (p *Platform) SelectDeployment(
	ctx context.Context,
	selector DeploymentSelector,
) (agent.Deployment, error)

SelectDeployment asks selector to choose from one stable active snapshot and returns the exact Deployment captured in that snapshot. Concurrent Replace or Undeploy cannot redirect the completed selection to a different binding.

func (*Platform) Undeploy

func (p *Platform) Undeploy(reference agent.DeploymentRef) error

Undeploy removes reference only when it is the exact active binding in its name slot. A stale reference returns ErrDeploymentConflict instead of deactivating a replacement. The exact binding remains in Catalog.

Jump to

Keyboard shortcuts

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