appenv

package
v1.166.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package appenv is how a run finds the application environment it executes in (#2696): the version that environment's release pins and its variables.

Index

Constants

View Source
const First = "\x00first"

First names the environment a draft runs in (#2709): the application's first, where its releases land, so a draft of a part reads and writes the first environment's schema and never the last's. No environment's name can be it.

Variables

View Source
var ErrNoEnvironment = errors.New("the application has no such environment")

ErrNoEnvironment is an environment the application does not have.

Functions

func ForRun

func ForRun(ctx context.Context, r Resolver, scriptID, env string) (name string, vars map[string]string, err error)

ForRun is the environment a run of scriptID in env ("" for the last) executes in and its variables, read when the run executes so a variable changed since it was queued is the one it sees. A script no application holds runs in none; a nil resolver resolves nothing.

func RunVersionIn

func RunVersionIn(ctx context.Context, r Resolver, sc *script.Script, env string) (int, error)

RunVersionIn is the version a run of sc in env executes. The last environment, named "", is what the script's released version already holds, read with no lookup, and so is the last named; any other is the version that environment's release pins, refused when sc belongs to no application, the application has no such environment, or its release pins no version of sc.

Types

type Resolver

type Resolver interface {
	ForScript(ctx context.Context, scriptID, env string) (*Script, error)
}

Resolver resolves a script's environment ("" for the last).

type Script

type Script struct {
	OK          bool
	Environment string
	Version     int
	Variables   map[string]string
	// Last is true when Environment is the application's last, which runs
	// what "" does: the script's released version (#2709).
	Last bool
}

Script is what a run of a script in an environment executes with (#2696): the version the environment's release pins (0 when it pins none), the environment's name, and its variables. OK is false for a script no application holds, which runs as it always has.

Jump to

Keyboard shortcuts

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