Documentation
¶
Overview ¶
Package product carries the identity of the product whose process the kernel is running inside.
The kernel is a LIBRARY. gapid links it and is the gapi product; goblind links the same code and is the goblin product, and an operator of goblind should never have to learn that gapi exists (GAPI-DIV-061). Every host-namespaced resource the kernel creates, reads or advertises therefore derives from this one value rather than from a literal:
- the environment prefix, and so every GAPI_/GOBLIN_ variable
- the config search directory, /etc/<product>
- the agent search paths, /usr/lib/<product>/agents and friends
- the default log path, /var/log/<product>/<product>.log
- cgroup names, <product>d-infra and <product>d-<id>
- the kmsg tag an operator reads in dmesg under --pid1
Three classes of gapi-spelling string exist in this repo and only the list above is one of them. PROSE - stderr prefixes, help text, Prometheus help - names the role instead ("supervisor"), because naming the vendor inside its own output is redundant even for gapid's own operator. WIRE - the gapi-quic ALPN, the gapi.v1 protobuf package names, the gapi_* metric names - MUST NOT CHANGE: renaming a protocol constant or a scraped metric is a compatibility break, and no operator reads an ALPN string off a terminal. That exclusion is written down so a later sweep does not "finish the job".
No usable default ¶
There is no fallback identity. Name() panics when nothing has been set, so a binary that forgets to declare itself dies at startup rather than quietly adopting gapi's namespace - which would mean ignoring the operator's configuration and booting on defaults. core/version tolerates the same set-then-read shape only because a late read there is cosmetic; a late read here is a misconfigured daemon.
The compile-time half of that guarantee lives in pkg/cli: the root constructors take the product as a parameter, so an embedder cannot build a command tree without naming itself. The panic covers the remainder - an embedder that uses the kernel without pkg/cli.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Daemon ¶
func Daemon() string
Daemon is the name of the product's daemon binary: gapi -> gapid, goblin -> goblind.
The "d" suffix is the silo's binary-naming convention, written down in cli-contract.md - four binaries, <product>d and <product>ctl. Deriving it rather than passing a second value is what keeps this ONE identity instead of two, and it holds today's strings exactly: gapid still tags dmesg with "gapid:" and still owns the "gapid-infra" cgroup. The tradeoff is that a product whose daemon is not <product>d would need a second value here.
func DefaultControlAddr ¶
func DefaultControlAddr() string
DefaultControlAddr is the product's zero-config control-plane address.
An identity with no declared address PANICS rather than falling back. A fallback would hand an unknown embedder gapi's port while every other surface said otherwise - which is the defect GAPI-DIV-071 exists to remove, one level up - and Name() already establishes that a missing identity is fatal rather than defaulted.
func DirectEnvNames ¶
func DirectEnvNames() []string
DirectEnvNames returns every declared direct name, fully composed, for the gate in core/config that checks documented names have readers.
func EnvKey ¶
EnvKey renders a declared suffix as a full environment variable name. An undeclared suffix panics rather than composing a name no gate knows about; add it to directEnv with its reader.
func IsSet ¶
func IsSet() bool
IsSet reports whether an identity has been declared, without panicking. For tests and for diagnostics that must not themselves fail.
func Name ¶
func Name() string
Name returns the product identity, panicking if none was declared.
The panic is the point. Returning "gapi" here would make a binary that forgot to declare itself read GAPI_* variables, search /etc/gapi and write dmesg lines an operator cannot attribute - a silently misconfigured daemon rather than a failed one.
func Set ¶
func Set(n string)
Set declares the product this process belongs to. Names are lowercase and alphanumeric: "gapi", "goblin".
Last writer wins, deliberately. A single process legitimately builds more than one command tree - goblinctl mounts gapictl's verbs under `agent`, and the flag-parity tests construct both roots side by side - so a set-once panic would fire on correct code. What makes that safe is that nothing here is read during package initialization; the ordering hazard the panic in Name() guards is a read before ANY set, not a second set.
Types ¶
This section is empty.