48 lines
2.6 KiB
Go
48 lines
2.6 KiB
Go
package catalogue
|
|
|
|
// IsToolRunner says whether a manifest is the node's tool runner's, as it says itself (`tool-runner`, issue 774): the
|
|
// one program on each node that loads every assigned module's tools bundle. Never known here by its name.
|
|
func IsToolRunner(m Manifest) bool { return m.ToolRunner }
|
|
|
|
// ToolRunnerOf is the module among manifests that says it is the tool runner, and whether one does.
|
|
func ToolRunnerOf(manifests []Manifest) (Manifest, bool) {
|
|
for _, m := range manifests {
|
|
if IsToolRunner(m) {
|
|
return m, true
|
|
}
|
|
}
|
|
return Manifest{}, false
|
|
}
|
|
|
|
// BundleRoot is where a machine keeps the tools bundles the mesh delivers to it: under the mesh's
|
|
// own directory, beside the daemons the host unpacks there, and never where a package manager also
|
|
// writes. One directory per module, one per bundle beneath it, at a path that does not move with
|
|
// the version — so the runtime's process names each entrypoint once and is restarted, not
|
|
// recomposed, when a bundle changes.
|
|
const BundleRoot = "/var/lib/mesh/bundles"
|
|
|
|
// RuntimeToolModules is the variable the runtime reads the modules it serves from: one
|
|
// `<module>=<entrypoint>` per file it loads, comma-separated — several entries may name one module.
|
|
// RuntimeBrokerFile is where it reads the node's credential; RuntimeOperatorAccount and
|
|
// RuntimeOperatorHome are the machine's operator account and home, handed to every tool's
|
|
// environment (to-be 38 WP1), and absent on a machine with no account.
|
|
const (
|
|
RuntimeToolModules = "MESH_TOOL_MODULES"
|
|
RuntimeBrokerFile = "MESH_BROKER_FILE"
|
|
RuntimeOperatorAccount = "MESH_OPERATOR_ACCOUNT"
|
|
RuntimeOperatorHome = "MESH_OPERATOR_HOME"
|
|
// RuntimeAgentAccount and RuntimeAgentHome are the account agents run as on the machine and its home
|
|
// (novox/hq ADR 0266): the agent account where the node names one, the operator account otherwise.
|
|
// The agent's module writes the agent's home from them; absent where neither account is known.
|
|
RuntimeAgentAccount = "MESH_AGENT_ACCOUNT"
|
|
RuntimeAgentHome = "MESH_AGENT_HOME"
|
|
// RuntimeToolEnv is every served module's composed environment, as JSON (novox/hq ADR 0192):
|
|
// {"<module>": {"<word>": "<value>"}}. The runtime takes it at start, removes it from its own
|
|
// environment and hands each module's words to that module's bundles alone. In the unit, so a
|
|
// change to any module's words changes the process and restarts it.
|
|
RuntimeToolEnv = "MESH_TOOL_ENV"
|
|
)
|
|
|
|
// OwnRuntimeID names the process a module of its own account is served by (novox/hq ADR 0259 §8).
|
|
func OwnRuntimeID() string { return "own-runtime" }
|