Documentation
¶
Overview ¶
Package runtime is the shared RPC-handler scaffolding every SC plugin uses: context construction with a local-engine fallback, deferred drain-then-settle of the Pulumi SDK context, harvest of pctx exports into ProvisionResponse.Outputs, and the compute-process parent-env swap. The patterns here are the ones all five plugin extractions eventually converged on; packaging them here keeps the next extraction (gcp) from re-copying the same four helpers again.
See forge/docs/design/2026-11-01/plugin-extraction-playbook/ for the trap catalogue this package exists to prevent, and forge/docs/design/2026-10-24/ sc-plugin-architecture/04-no-destroy-invariant.md Addendum V for the methodology that produced it.
Index ¶
- func ComponentRawFromComputeProcessRequest(req *scpluginv1.ComputeProcessRequest) (map[string]any, error)
- func ComponentRawFromProvisionRequest(req *scpluginv1.ProvisionRequest) (map[string]any, error)
- func DecodeInputs[T any](inputs map[string]*scpluginv1.InputValue, out *T) error
- func DependencyOutputsFromComputeProcessRequest(req *scpluginv1.ComputeProcessRequest) (map[string]*api.ResourceOutput, error)
- func DependencyOutputsFromProvisionRequest(req *scpluginv1.ProvisionRequest) (map[string]*api.ResourceOutput, error)
- func HandlePluginInvoke(ctx context.Context, req *scpluginv1.PluginInvokeRequest) (*scpluginv1.PluginInvokeResponse, error)
- func HarvestExports(ctx context.Context, pctx *sdk.Context) (map[string]*scpluginv1.InputValue, error)
- func LocalEngineAddress(fromHeader string, progress *scPlugin.Publisher) (string, error)
- func ParentInfoFromProvisionRequest(req *scpluginv1.ProvisionRequest) (*pApi.ParentInfo, error)
- func ParentInfoFromRequest(req *scpluginv1.ComputeProcessRequest) (*pApi.ParentInfo, error)
- func RegisterPeerCapability(capability string, handler PeerCapabilityHandler) error
- func ResetPeerCapabilitiesForTesting()
- func ResourceInputForComputeProcess(req *scpluginv1.ComputeProcessRequest, parent *pApi.ParentInfo, cfg any) api.ResourceInput
- func RunComputeProcess(stdctx context.Context, rctx *Context, stack api.Stack, ...) (*scpluginv1.ComputeProcessResponse, *api.ResourceOutput, error)
- func Settle[T any](rctx *Context, resp **T, err *error)
- type Collector
- func (c *Collector) AddDependency(sdk.Resource)
- func (c *Collector) AddDependencyTplExtension(depName, resName string, values map[string]string)
- func (c *Collector) AddEnvVariableIfNotExist(name, value, resType, resName, stackName string)
- func (c *Collector) AddOutput(_ *sdk.Context, o sdk.Output)
- func (c *Collector) AddPostProcessor(any, pApi.PostProcessor)
- func (c *Collector) AddPreProcessor(any, pApi.PreProcessor)
- func (c *Collector) AddResourceTplExtension(resName string, values map[string]string)
- func (c *Collector) AddSecretEnvVariableIfNotExist(name, value, resType, resName, stackName string)
- func (c *Collector) Dependencies() []sdk.Resource
- func (c *Collector) EnvVariables() []pApi.ComputeEnvVariable
- func (c *Collector) GetPostProcessors(any) ([]pApi.PostProcessor, bool)
- func (c *Collector) GetPreProcessors(any) ([]pApi.PreProcessor, bool)
- func (c *Collector) Outputs() []sdk.Output
- func (c *Collector) ResolvePlaceholders(any) error
- func (c *Collector) ResourceOutputs() pApi.ResourcesOutputs
- func (c *Collector) RunPostProcessors(any, any) error
- func (c *Collector) RunPreProcessors(any, any) error
- func (c *Collector) SecretEnvVariables() []pApi.ComputeEnvVariable
- type ComputeProcessHandler
- type Context
- type ContextOption
- type PeerCapabilityHandler
- type RunComputeProcessOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComponentRawFromComputeProcessRequest ¶
func ComponentRawFromComputeProcessRequest(req *scpluginv1.ComputeProcessRequest) (map[string]any, error)
ComponentRawFromComputeProcessRequest unmarshals the ComponentRaw bytes a ComputeProcessRequest carries when the ComputeProcess call fires on an SC Component resource (whose plugin advertises SchemaResponse.supports_component). Mirrors ComponentRawFromProvisionRequest: same JSON shape, same decoding semantics, different RPC side.
Lights up the component plugin's compute path: a Component's `databases:` + `atlasAdmin:` + ... config was already reachable from its Provision via the Provision-side side-channel; the ComputeProcess side had no equivalent carrier until the companion proto field landed on ComputeProcessRequest. Without this, sc-component-backup's `maybeProvisionScopedUser` was a no-op in production because the compute processor received an empty Config.Raw.
Opt-in via `SchemaResponse.supports_component` advertise. Nil/empty bytes return `(nil, nil)`; that's every non-component ComputeProcess call.
func ComponentRawFromProvisionRequest ¶
func ComponentRawFromProvisionRequest(req *scpluginv1.ProvisionRequest) (map[string]any, error)
ComponentRawFromProvisionRequest unmarshals the ComponentRaw bytes a ProvisionRequest carries when SC core dispatched this plugin's template via a Component resource's `deployTo:` (slice 1a.1 of sc-components-platform; design doc §#19 path (b)).
The returned map carries the operator-declared component config (image, env, ingress, signingKey, …) as it appeared in server.yaml. Plugin's ProvisionFunc overlays these onto its typed input struct before building the cloud resource. Returns nil when the resource was NOT dispatched as a Component — every non-component Provision call hits this + ignores it.
Only plugins that advertise supports_component in Schema should call this; absent advertise + non-empty ComponentRaw is a SC-core parse-time refusal, so this helper is only reached after the plugin opted in.
Memory cross-ref: interface_assertion_against_plugin_owned_value_fails_in_prod.
func DecodeInputs ¶
func DecodeInputs[T any](inputs map[string]*scpluginv1.InputValue, out *T) error
DecodeInputs unmarshals a plugin RPC's inputs map into a typed Go struct via a yaml round-trip. Uses scPlugin.InputsToPlain to flatten the proto InputValue tree first — nested maps and lists (e.g. stackConfig.image.* in an aws lambda deploy) round-trip correctly, which the earlier scalar-only variants in aws/mongodb/cloudru's main.go lost. Live-caught against forge-notifier staging preview 2026-10-30.
Returns yaml.Unmarshal's error directly; callers typically wrap it with the resource-type context.
func DependencyOutputsFromComputeProcessRequest ¶
func DependencyOutputsFromComputeProcessRequest(req *scpluginv1.ComputeProcessRequest) (map[string]*api.ResourceOutput, error)
DependencyOutputsFromComputeProcessRequest unmarshals the DependencyOutputsJson field a ComputeProcess request carries into the shape a plugin's ComputeProcessor reads. Mirrors DependencyOutputsFromProvisionRequest (same JSON shape, same decoding semantics) — different request side, same wire contract.
Added as the ComputeProcess-side symmetry of the Provision-side dep-outputs fix. Lights up sc-component-backup's slice 1d scoped-user plumbing (sc-component-backup 06721b1, design doc §5.2) end-to-end: a ComputeProcessor can now see the consumer's sibling-resource outputs (mongo-uri, database name, etc.) at `uses:` time + mint per-consumer scoped credentials.
Returns a nil map when the request carries no dependencies (older SC core, or a resource whose consumers don't opt in).
func DependencyOutputsFromProvisionRequest ¶
func DependencyOutputsFromProvisionRequest(req *scpluginv1.ProvisionRequest) (map[string]*api.ResourceOutput, error)
DependencyOutputsFromProvisionRequest unmarshals the DependencyOutputsJson field a provision request carries into the shape a plugin's Provision body reads via ProvisionParams.ResourceOutputs. Returns a nil map when the request carries no dependencies (every resource whose config does NOT implement api.WithParentDependencies, or an older SC core that pre-dates the field).
Shape contract (api PR adding this helper): SC core's plugin_sidecars.go packs the map[resourceName]*api.PluginResourceOutput from params.ResourceOutputs via json.Marshal. Plugin side decodes into the same shape and lifts each entry onto a `*api.ResourceOutput` with `Ref: *api.PluginResourceOutput`, which is exactly what sibling resources' Provision bodies already type-assert on post-#569. An in-tree dep whose Ref was a typed Go struct is NOT packed on the sidecar side (the receiving plugin can't unmarshal unknown struct shapes); the plugin body reads that as absent and errors normally.
Live-caught 2026-11-08 on sc-plugin-gcp tier-2 smoke: `gcp-docker-image-push` read `params.ResourceOutputs[registryResource].Ref.(*ArtifactRegistryOut)` and failed with `expected registry resource %q to be present in outputs` because this field was declared on the proto (`dependency_outputs = 5`) but never populated by any sidecar. The flat string map was too narrow to carry PluginResourceOutput; a JSON bytes field matches the shape #569 introduced.
See forge/docs/roadmap/items/sc-plugin-dependency-outputs-not-populated.md.
func HandlePluginInvoke ¶
func HandlePluginInvoke(ctx context.Context, req *scpluginv1.PluginInvokeRequest) (*scpluginv1.PluginInvokeResponse, error)
HandlePluginInvoke is the plugin-side dispatch for SCCloudPlugin.PluginInvoke. The plugin's main.go wires its RPC handler as a one-liner:
func (p *myPlugin) PluginInvoke(ctx context.Context,
req *scpluginv1.PluginInvokeRequest) (*scpluginv1.PluginInvokeResponse, error) {
return runtime.HandlePluginInvoke(ctx, req)
}
HandlePluginInvoke looks the capability up in the registry, runs the handler, and wraps the reply bytes. Returns a clear "not registered" error when the capability has no handler on this binary — distinct from the broker's "not advertised" error, which fires before the RPC reaches the plugin at all.
func HarvestExports ¶
func HarvestExports(ctx context.Context, pctx *sdk.Context) (map[string]*scpluginv1.InputValue, error)
HarvestExports reads every `pctx.Export(k, v)` call made during an RPC handler and converts each value into an InputValue the wire can carry. Awaits every sdk.Output so a late-resolving ApplyT chain (bucket Arn, access key, etc.) lands as a concrete string on apply — remains unknown during preview, which is expected.
Preserves the Secret flag through the serialisation boundary. Lose it and the value lands plaintext in the parent stack root's output map, `pulumi stack output` serves it as a bare string, and the apply/preview logs print it clear. Live-caught 2026-10-31 on the first aws harvest preview — see Addendum V of forge/docs/design/2026-10-24/sc-plugin-architecture/04-no-destroy-invariant.md.
SC core re-exports whatever this returns onto its own pctx at api/pkg/clouds/pulumi/plugin_sidecars.go (api v2026.10.60+).
func LocalEngineAddress ¶
LocalEngineAddress returns an engine address a plugin Context should use: the one core named in the request header (fromHeader), or a process-wide local fallback if the header is empty.
The fallback is lazily initialised on first call and shared across every Context the plugin ever opens — a plugin process has one localEngine, not one per RPC. The progress publisher is the plugin's own log sink; log lines routed through the local engine land on it.
func ParentInfoFromProvisionRequest ¶
func ParentInfoFromProvisionRequest(req *scpluginv1.ProvisionRequest) (*pApi.ParentInfo, error)
ParentInfoFromProvisionRequest decodes the ParentInfoJson field a plugin's Provision RPC carries when the deploying stack has a parent. Returns a nil ParentInfo when the field is empty — either no parent (a parent-stack provision itself, not a child) or an older SC core that pre-dates the field (`sc-plugin-provisionrequest-missing-parent-info` roadmap item).
Plugin templates that reach into `params.ParentStack.*` MUST nil-check the returned pointer AND the pointer they set on ProvisionParams. The two guardrails ship together: the wire path is only half the fix; the template body's nil check is the other half, because an older plugin binary talking to a newer core, or a preview-only client with no parent, both produce a nil ParentStack that nil-derefs in the template's internal/* body otherwise.
Same ParentInfo shape (serialised Go-field-named JSON) as the compute process path.
func ParentInfoFromRequest ¶
func ParentInfoFromRequest(req *scpluginv1.ComputeProcessRequest) (*pApi.ParentInfo, error)
ParentInfoFromRequest unmarshals the ParentInfoJson field a compute-process request carries into a ParentInfo struct. Returns a nil ParentInfo when the request has no parent (every non-compute-process RPC).
IMPORTANT: ParentInfo is serialised by SC core via json.Marshal with the struct's capitalised Go field names (StackName / FullReference), and the struct has no yaml tags. Using json.Unmarshal here matches what the wire actually carries. A yaml.Unmarshal would quietly land every field empty.
func RegisterPeerCapability ¶
func RegisterPeerCapability(capability string, handler PeerCapabilityHandler) error
RegisterPeerCapability stores a handler against a capability name. Overwrites a prior registration for the same name; a plugin re- registering is a legal "replace" operation (useful under tests). Returns an error only for empty inputs.
func ResetPeerCapabilitiesForTesting ¶
func ResetPeerCapabilitiesForTesting()
ResetPeerCapabilitiesForTesting wipes the registry. Only meant for tests — a production plugin registers capabilities once and does not un-register them.
func ResourceInputForComputeProcess ¶
func ResourceInputForComputeProcess(req *scpluginv1.ComputeProcessRequest, parent *pApi.ParentInfo, cfg any) api.ResourceInput
ResourceInputForComputeProcess builds the api.ResourceInput a plugin compute-process handler hands to the driver. Critically, it swaps the child environment for the parent's when ParentInfo.ParentEnv is non-empty: compute processors read their parent's exports from the parent stack root, and those export keys use the parent's env suffix (`forge-storage--staging--bucket-name`), not the child's.
input.ToResName (api/pkg/api/server.go) prefers StackParams.ParentEnv over StackParams.Environment, so pre-swapping Environment here lets the compute processor's own code stay env-agnostic.
Live-caught 2026-11-01 on forge-storage isolated deploy run 41290064279: client env `108b3f` built lookup key `forge-storage--108b3f--bucket-name` which did not exist in the parent (parent exports under `--staging`). Fixed in sc-plugin-aws v2026.11.01-92f5d1b; this is the extracted shape.
func RunComputeProcess ¶
func RunComputeProcess( stdctx context.Context, rctx *Context, stack api.Stack, input api.ResourceInput, params pApi.ProvisionParams, handler ComputeProcessHandler, opts ...RunComputeProcessOption, ) (*scpluginv1.ComputeProcessResponse, *api.ResourceOutput, error)
RunComputeProcess owns the ComputeProcess sequence end-to-end:
- Build a fresh Collector. Incoming pool is empty by default; pass `WithIncomingEnvVars(req)` to seed it from the request (slice 1d.7 auto-discover, mirror of NewProvisionCollector).
- Call the plugin's handler, which emits via the collector's exported pApi.ComputeContextCollector methods.
- Drain the captured sdk.Output chains so every ApplyT-wrapped env mutation is in the outgoing pool.
- Marshal the outgoing pool into a ComputeProcessResponse.
The plugin's handler cannot see the response marshal step, so it cannot omit the drain. This is the only exported path to a ComputeProcessResponse from this package, by design.
The urn field of the returned response is left to the caller to set — the plugin's dispatch layer typically fills it from the handler's *api.ResourceOutput, so RunComputeProcess returns both for the caller to compose.
func Settle ¶
Settle runs a handler's deferred context teardown and folds its error into the handler's result: the RPC response is only sent once every registration the handler started has reached the engine, and a registration that failed fails the RPC instead of being lost. A handler error already set takes precedence.
Idiomatic use at the top of every handler:
rctx, err := runtime.NewContext(stdctx, req.GetHeader(), runtime.WithLocalEngineFallback(p.progress))
if err != nil { return nil, err }
defer runtime.Settle(rctx, &resp, &err)
The handler's named return values must be (resp *T, err error) for Settle to fold them.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector is the plugin-side implementation of pApi.ComputeContextCollector. Every SC plugin's Provision and ComputeProcess uses it to record what its in-plugin driver emits — env variables, template extensions, and the sdk.Output chains those are resolved from — and (in ComputeProcess) hand that back to SC core as a scpluginv1.ComputeProcessResponse.
Why this type exists in a shared package (not re-written per plugin) ¶
sc-plugin-aws's per-plugin collector had `AddOutput(_ sdk.Output) {}` as a no-op. Every ApplyT-wrapped env mutation it ran was discarded. ComputeProcess returned "emitted 0 env var(s)" with no error, the deploy went green, consumer Lambdas booted without their `uses:` env, health checks passed, uploads failed. Live-caught on agent-native-pdf-rendering run f4355798 (2026-11-02). See forge/docs/roadmap/items/sc-plugin-aws-s3-compute-process-drops-env-silently.md.
sc-plugin-mongodb had the correct capture + drain. The fix never reached aws because capturingCollector was per-plugin and the Slice B/C runtime port lifted drain / harvest / Settle / parent-env swap into shared code but left this one behind. sc-plugin-yandex has the identical defect — `ObjectStorageBucketComputeProcessor` (plugin/internal/compute_proc.go:82) wraps every S3_* env mutation in an ApplyT and the plugin's AddOutput is a no-op. Hasn't bitten only because no stack currently declares `uses: [<yc-bucket>]`; forge-atrium's S6 (YC Mongo + RU storage) is the trigger.
How this type closes the failure mode ¶
Hoisting the collector code alone would not close trap 16 — a plugin author who forgets to call `AwaitOutputs` between the processor and `ToResponse` reproduces the aws bug exactly, with a shared implementation behind it. Call-site discipline isn't the fix.
So the drain is MANDATORY by construction: the methods that marshal a response and drain the outputs are PACKAGE-PRIVATE (`toResponse` / `awaitOutputs`), and the only exported path to a response is `RunComputeProcess`, which owns the fn → drain → marshal sequence. A plugin's ComputeProcess handler never touches `ToResponse` or `AwaitOutputs` directly, so it cannot omit the drain even by accident.
The incoming/outgoing pool split (trap 14) ¶
A plugin that runs BOTH Provision (reads INCOMING env vars from the consuming stack's `uses:` resources via ProvisionRequest.compute_env_vars) AND ComputeProcess (writes OUTGOING env vars from its own resources) in the same deploy must separate the pools or confuse the two. See forge/docs/design/2026-11-01/plugin-extraction-playbook/ trap 14 for the forge-notifier incident that produced this split.
`NewProvisionCollector(req)` seeds the incoming pool from the request. `RunComputeProcess` constructs an empty one BY DEFAULT — a plugin that wants a Component-style auto-discover (read env vars emitted by prior sibling compute processors on the same consumer deploy) opts in with `runtime.WithIncomingEnvVars(req)`, which seeds the incoming pool from `ComputeProcessRequest.compute_env_vars` the same way the Provision path seeds from its own compute_env_vars. Plugins that don't pass the option keep today's empty-pool behaviour. See sc-component-backup slice 1d.7 (roadmap: sc-components-backup-auto-discover-databases) for the live caller.
func NewProvisionCollector ¶
func NewProvisionCollector(req *scpluginv1.ProvisionRequest) *Collector
NewProvisionCollector builds a Collector seeded from a Provision request's compute_env_vars so EnvVariables() / SecretEnvVariables() return what the consuming stack's `uses:` resources contributed.
Pass nil for a Provision context that genuinely has no incoming env (`type: static` templates with no `uses:`, for instance); the incoming pool stays empty.
Provision never calls `ToResponse` — the ProvisionResponse that crosses the bus carries HarvestExports output, not collector mutations. So this constructor is write-safe for the plugin's template driver and does not need the drain/marshal path.
func (*Collector) AddDependency ¶
The pApi.ComputeContextCollector methods below carry Pulumi sdk.Resource handles or Go closures that do not cross the plugin bus. A plugin that needs them applies them against its own sdk.Context before Build. See api/pkg/plugin/compute.go for the general rule.
func (*Collector) AddDependencyTplExtension ¶
AddDependencyTplExtension appends to the dependency-template extension list.
func (*Collector) AddEnvVariableIfNotExist ¶
AddEnvVariableIfNotExist appends to the OUTGOING pool. The name is historical (pApi's interface shape) — this implementation does not deduplicate, since the SC-core sidecar's own IfNotExist semantics on the consuming stack's collector handle that.
func (*Collector) AddOutput ¶
AddOutput records an sdk.Output whose resolution mutates this collector. RunComputeProcess drains the captured slice before marshalling, so an ApplyT callback that adds env vars is guaranteed to have run before the response is built.
This is the fix for trap 16 — the per-plugin implementations had this as `AddOutput(_ sdk.Output) {}`, so every env mutation written from inside an ApplyT was silently discarded.
func (*Collector) AddPostProcessor ¶
func (c *Collector) AddPostProcessor(any, pApi.PostProcessor)
func (*Collector) AddPreProcessor ¶
func (c *Collector) AddPreProcessor(any, pApi.PreProcessor)
func (*Collector) AddResourceTplExtension ¶
AddResourceTplExtension appends to the resource-template extension list.
func (*Collector) AddSecretEnvVariableIfNotExist ¶
AddSecretEnvVariableIfNotExist appends to the outgoing pool with Secret=true.
func (*Collector) Dependencies ¶
func (*Collector) EnvVariables ¶
func (c *Collector) EnvVariables() []pApi.ComputeEnvVariable
EnvVariables returns the incoming (non-secret) compute env vars. Readers: the per-plugin template driver that populates a deployed container's env.
func (*Collector) GetPostProcessors ¶
func (c *Collector) GetPostProcessors(any) ([]pApi.PostProcessor, bool)
func (*Collector) GetPreProcessors ¶
func (c *Collector) GetPreProcessors(any) ([]pApi.PreProcessor, bool)
func (*Collector) Outputs ¶
Outputs returns a copy of the captured output slice. Exposed for pApi.ComputeContextCollector; RunComputeProcess uses `awaitOutputs` directly instead.
func (*Collector) ResolvePlaceholders ¶
func (*Collector) ResourceOutputs ¶
func (c *Collector) ResourceOutputs() pApi.ResourcesOutputs
func (*Collector) SecretEnvVariables ¶
func (c *Collector) SecretEnvVariables() []pApi.ComputeEnvVariable
SecretEnvVariables returns the incoming SECRET compute env vars. Same reader shape as EnvVariables; the Secret flag drives the template to resolve the value via a secrets manager rather than baking it into the env directly.
type ComputeProcessHandler ¶
type ComputeProcessHandler func( ctx *sdk.Context, stack api.Stack, input api.ResourceInput, collector pApi.ComputeContextCollector, params pApi.ProvisionParams, ) (*api.ResourceOutput, error)
ComputeProcessHandler is the signature every in-plugin compute processor has — same shape as pApi.ComputeProcessorFunc, lifted here so plugins don't need to import pApi in their dispatch glue.
type Context ¶
Context wraps a Pulumi SDK context plus the deferred teardown that drains pending RegisterResource goroutines before closing it. Every plugin RPC handler constructs one with NewContext and defers Settle on the result.
func NewContext ¶
func NewContext(ctx context.Context, h *scpluginv1.RequestHeader, opts ...ContextOption) (*Context, error)
NewContext builds a Pulumi SDK context from a plugin request header plus the deferred teardown. The returned Context's done function waits for all outstanding RegisterResource goroutines and then closes the SDK context — handlers must call it via Settle (or Done()) before returning, or in-flight registrations will be dropped and SC core will plan a destroy of every state entry on the next apply.
See forge/docs/design/2026-10-24/sc-plugin-architecture/04-no-destroy-invariant.md Addendum U for the cascade this guard prevents.
type ContextOption ¶
type ContextOption func(*contextOptions)
ContextOption configures NewContext's behaviour.
func WithContextFactory ¶
func WithContextFactory(fn func(context.Context, *scpluginv1.RequestHeader) (*sdk.Context, error)) ContextOption
WithContextFactory replaces sdk.NewContext with a test seam. Production callers do not need this.
func WithDryRun ¶
func WithDryRun(dryRun bool) ContextOption
WithDryRun overrides the header's dry-run flag. The usual callers do not need this — NewContext reads header.GetDryRun() by default. Exposed for tests that construct a header-less context directly.
func WithLocalEngineFallback ¶
func WithLocalEngineFallback(progress *scPlugin.Publisher) ContextOption
WithLocalEngineFallback opts the context into using LocalEngineAddress when the request header carries no engine address. The progress publisher is the plugin's log sink — pulumi log calls routed through the local engine land on it. Without this option a header with no engine address returns an error (the aws plugin's historical shape).
type PeerCapabilityHandler ¶
type PeerCapabilityHandler func(ctx context.Context, callingPlugin string, payloadJSON []byte) ([]byte, error)
PeerCapabilityHandler is a plugin-authored function that handles one named capability dispatched via SCCloudPlugin.PluginInvoke. Payload and reply are opaque JSON bytes; shapes are documented in each plugin's README.
Handlers are registered up-front (typically in plugin's `main.go` on start-up) via `RegisterPeerCapability`. The capability names must match the plugin's SchemaResponse.peer_capabilities; SC core rejects calls to unadvertised capabilities before they reach the plugin.
type RunComputeProcessOption ¶
type RunComputeProcessOption func(*runComputeProcessOptions)
RunComputeProcessOption configures `RunComputeProcess` at the call site. The option set is small and additive; add a new one when a plugin needs a capability that doesn't fit the handler signature.
func WithIncomingEnvVars ¶
func WithIncomingEnvVars(req *scpluginv1.ComputeProcessRequest) RunComputeProcessOption
WithIncomingEnvVars seeds the collector's incoming pool from a ComputeProcessRequest. `collector.EnvVariables()` / `SecretEnvVariables()` then return env vars that PRIOR sibling compute processors in the same consumer deploy have emitted — the mirror of `NewProvisionCollector`'s behaviour on the Provision side.
Plugins that don't need auto-discover (every current plugin except sc-component-backup slice 1d.7 and its successors) MUST NOT pass this option — their compute processors write to the outgoing pool only and today's empty incoming pool is the right default.
Passing a nil req is a no-op (keeps the empty pool).