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

capability

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PostgreSQL = Provider{
		Kind:         ProviderPostgreSQL,
		Capabilities: []Kind{SQL},
	}
	Valkey = Provider{
		Kind:         ProviderValkey,
		Capabilities: []Kind{KeyValue},
	}
	OpenBao = Provider{
		Kind:         ProviderOpenBao,
		Capabilities: []Kind{Secrets},
	}
)

Reference providers describe the capability products already used by the current Compose implementation. They are descriptors only: existing provisioning remains authoritative until it is migrated behind the shared lifecycle in later v0.4.1 commits.

Functions

This section is empty.

Types

type Binding

type Binding struct {
	Resource Resource `json:"resource"`
	Workload string   `json:"workload"`
}

type Diagnostic

type Diagnostic struct {
	Code     string   `json:"code"`
	Severity Severity `json:"severity"`
	Message  string   `json:"message"`
}

type Driver

type Driver interface {
	Descriptor() Provider
	Preflight(context.Context, Resource, Binding) error
	Provision(context.Context, Resource) error
	Bind(context.Context, Resource, Binding) error
	Verify(context.Context, Resource, Binding) error
}

type Kind

type Kind string

Kind identifies portable application behavior. It describes what an application needs, never which product or runtime satisfies that need.

const (
	SQL      Kind = "database.sql"
	KeyValue Kind = "cache.key-value"
	Secrets  Kind = "secrets"
)

type Phase

type Phase string
const (
	PhaseResolve   Phase = "resolve"
	PhasePreflight Phase = "preflight"
	PhaseApply     Phase = "apply"
	PhaseBind      Phase = "bind"
	PhaseVerify    Phase = "verify"
)

type Plan

type Plan struct {
	Application string     `json:"application"`
	Items       []PlanItem `json:"items"`
}

func BuildPlan

func BuildPlan(application string, requests []Request) (Plan, error)

type PlanItem

type PlanItem struct {
	Resource Resource `json:"resource"`
	Binding  Binding  `json:"binding"`
}

type Provider

type Provider struct {
	Kind         ProviderKind `json:"kind"`
	Capabilities []Kind       `json:"capabilities"`
}

Provider describes the capability surface of one provider implementation. Placement, ownership and shared/dedicated/external scope deliberately remain outside this v0.4.1 foundation and are introduced by the provider registry.

func (Provider) Supports

func (p Provider) Supports(kind Kind) bool

type ProviderKind

type ProviderKind string

ProviderKind identifies a capability implementation. Capability providers are independent from runtime providers such as Compose.

const (
	ProviderPostgreSQL ProviderKind = "postgresql"
	ProviderValkey     ProviderKind = "valkey"
	ProviderOpenBao    ProviderKind = "openbao"
)

type Request

type Request struct {
	Requirement Requirement
	Workload    string
	Driver      Driver
}

type Requirement

type Requirement struct {
	Kind Kind   `json:"kind"`
	Name string `json:"name"`
}

Requirement is one application-owned logical capability request.

type Resource

type Resource struct {
	Application string       `json:"application"`
	Kind        Kind         `json:"kind"`
	Name        string       `json:"name"`
	Provider    ProviderKind `json:"provider"`
}

Resource is the provider-backed representation of one stable logical application resource. Provider-specific object names, ports and credentials are intentionally absent.

func Resolve

func Resolve(application string, requirement Requirement, provider Provider) (Resource, error)

Resolve validates capability negotiation before any provider mutation occurs. It intentionally performs no discovery or provider selection policy; those belong to the later registry layer.

type Result

type Result struct {
	Application string       `json:"application"`
	Status      Status       `json:"status"`
	Plan        Plan         `json:"plan"`
	Steps       []StepResult `json:"steps"`
}

func Run

func Run(ctx context.Context, application string, requests []Request) (Result, error)

Run executes one deterministic capability lifecycle. Every resource is resolved and every provider preflight is completed before the first provisioning mutation starts.

type Severity

type Severity string
const (
	SeverityInfo  Severity = "info"
	SeverityError Severity = "error"
)

type Status

type Status string
const (
	StatusReady  Status = "ready"
	StatusFailed Status = "failed"
)

type StepResult

type StepResult struct {
	Phase       Phase        `json:"phase"`
	Status      Status       `json:"status"`
	Resource    Resource     `json:"resource"`
	Binding     Binding      `json:"binding"`
	Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
}

Jump to

Keyboard shortcuts

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