Documentation
¶
Overview ¶
Package opname is the single source of truth for what a stack name and an operation (rule) name may contain. Names are persisted contract identifiers — they become DB keys, `stage = stack/scope` path components, trace directory names, and continuation `opDir` segments — so they are validated (rejected) at the write boundary rather than silently transformed. The filesystem sanitizers in the *store backends remain as belt-and-suspenders; this is the loud upstream gate.
Pure: no FS/DB/deps, so both the admin API and the opstack loader can import it without a cycle. Tenant-reservation policy (e.g. boot/* is _sys-owned) is NOT here — that stays with the admin layer that knows the acting tenant.
Index ¶
Constants ¶
const CallScheme = "call://"
CallScheme is the EXEC scheme of a stack call: `EXEC "call://<stack>"` runs another stack in process, inside the same request, and answers with one result object; `EXEC "call://<stack>/<scope>"` enters it at a floor.
const GotoScheme = "goto://"
GotoScheme is the EXEC scheme of a stage jump written as a scheme: `EXEC "goto://<stack>/<scope>"` or `EXEC "goto://<scope>"`.
const LikeEscapeChar = `\`
LikeEscapeChar is the ESCAPE character callers should declare when matching a name with SQL LIKE. It is not a legal name character, so it can never collide with real data.
Variables ¶
var ErrName = errors.New("invalid name")
ErrName is the sentinel for any invalid name (wrapped with detail).
Functions ¶
func CallTarget ¶ added in v0.2.48
CallTarget parses an `EXEC "call://…"` value into the stack to call and the scope to enter it at. A target is `<stack>` (entered at scope 0) or `<stack>/<scope>`: the last segment is the scope when it is all digits, exactly as a goto target is read, so a stack whose last segment is a number cannot be called at its floor (name it with a scope). The target is literal; a stack chosen at run time is `WITH stack = ._next`.
It is the one check behind the parser (an apply-time error), lint and the processor (a result error), so all three agree on what is a target.
func EscapeLike ¶ added in v0.2.24
EscapeLike escapes every SQL LIKE metacharacter in s so the result matches LITERALLY under `LIKE ? ESCAPE '\'`. Use it on any name (or user-supplied prefix) that is spliced into a LIKE pattern — see the '_' note on seg.
Callers that deliberately want '%' to stay a wildcard (the ops resolver's `boot/%` ingress fallthrough is the only one) must escape '_' alone instead; see processor.escapeLikeLiterals.
func GotoTarget ¶ added in v0.2.40
GotoTarget parses an `EXEC "goto://…"` value and returns its target, the value the jump writes to `_txc.goto`. The target is either `<stack>/<scope>` (a stage, the stack a valid stack name) or a bare `<scope>` in the current stack, exactly the two forms `EMIT @goto` takes. The target is literal: a jump computed at run time is `EMIT @goto = ._next`.
It is the one check behind the parser (an apply-time error), lint and the processor (a runtime error), so all three agree on what is a target.
func ValidStack ¶
ValidStack reports whether name is a usable stack name. A stack name is one or more "/"-joined segments (e.g. "hello-world", "_sys/boot"); every segment obeys the same charset as an operation name, so there is no empty/'.'/'..'/'%'/leading-or-trailing-slash/double-slash form.
Types ¶
This section is empty.