operation

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PathToOpRE = regexp.MustCompile(`OPS/(?P<stack>(?:\$boot)|(?:\$service(?:\/\$slot)*)).*?/?(?P<scope>\d+)\D*\/(?P<file>(?:resonator.txcl))$`)

Functions

func MetaFromContext

func MetaFromContext(ctx context.Context) string

MetaFromContext returns the meta string set by WithMeta, or "" if none was attached. Empty return is safe to gjson.Get against.

func WithMeta

func WithMeta(ctx context.Context, meta string) context.Context

WithMeta attaches the op's Meta string to ctx for downstream OpsHandler consumption. Empty meta is a no-op.

Types

type Operation

type Operation struct {
	Input     string `json:"input,omitempty"`
	Output    string `json:"output,omitempty"`
	Service   string `json:"service,omitempty"`
	Slot      string `json:"slot,omitempty"`
	Stack     string `json:"stack,omitempty"`
	Scope     int    `json:"scope,omitempty"`
	Name      string `json:"name,omitempty"` // filename-derived identity within (stack, scope); empty for legacy rules
	Txcl      string `json:"txcl,omitempty"`
	MockRes   string `json:"mockRes,omitempty"`
	MockReq   string `json:"mockReq,omitempty"`
	Resonator *resonator.Resonator
	Meta      string `json:"meta,omitempty"`
	OpID      string `json:"opId,omitempty"` // unique ID for this Operation

	// Secrets holds materialized secret cleartext for this op
	// instance. The field is tagged `json:"-"` AND its type's
	// MarshalJSON / MarshalText / GobEncode all panic, so cleartext
	// cannot reach any envelope, trace, log, mock, or continuation
	// by construction (internal docs/todo-secret-store.md §4.1).
	//
	// Populated by the processor (PR 3) between WHEN/SET/SELECT/WITH
	// decoration and Exec; zeroed via defer on every exit path. Read
	// directly by secret-aware op handlers as op.Secrets.Get(NAME);
	// handlers never call the Resolver or Store themselves.
	Secrets secrets.SecretBag `json:"-"`
}

func New

func New() *Operation

New Create a new Operation

func PathToOperation

func PathToOperation(path string) (*Operation, error)

func (*Operation) Copy

func (op *Operation) Copy() *Operation

Copy Create a shallow copy of the Operation, forcing a new OpID.

Secrets bag is shared by reference (SecretBag's internal map is not deep-copied). Copy() is called within a single request scope to spawn a new execution instance; the copy and the original both see the same materialized cleartext, and the processor's deferred Zero() wipes both views in one call. Sharing is correct here.

func (*Operation) MacroExpand

func (op *Operation) MacroExpand(input string, service string, slot string) (output string)

Jump to

Keyboard shortcuts

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