ProcessDefinitionRegistry
Maps a process definition's name to its built {@see ProcessDefinition} — the directory a consumer registers every process it wants callable by name (typically at boot) and the `process_instantiate` tool (see {@see \Milpa\Orchestrator\Tools\ProcessInstantiateTool}) resolves through when a caller names a definition to start. Also the seam {@see ProcessRunner} resolves a {@see SubprocessSpec::$definitionRef} through at runtime when entering a subprocess state. `register()` validates the definition-REFERENCE graph (which name's subprocess states point at which other names, transitively) stays acyclic — a process cannot, directly or through any chain of subprocess states, end up waiting on itself. This is a STATIC, name-level check, independent of {@see ProcessRunner}'s own runtime depth limit (which guards the same failure mode at the instance level, in case a cycle somehow slips past this check — e.g. a definition mutated after registration).
ProcessDefinitionRegistry::register()
public function register(string $name, Milpa\Orchestrator\ProcessDefinition $definition): voidRegisters `$definition` under `$name`, overwriting any prior registration for the same name. Rolled back entirely (the registry ends up exactly as it was before this call) when the resulting definition-reference graph turns out cyclic, so a caller that catches the exception and keeps using this registry is not left with a partially-corrupted graph.
Parameters
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $definition | Milpa\Orchestrator\ProcessDefinition |
Throws
\RuntimeException when this registration completes a cycle in the
definition-reference graph (`$name`, directly or transitively
through any subprocess state, references itself)
ProcessDefinitionRegistry::has()
public function has(string $name): boolWhether a definition is registered under `$name`.
Parameters
| Name | Type | Description |
|---|---|---|
| $name | string |
ProcessDefinitionRegistry::get()
public function get(string $name): Milpa\Orchestrator\ProcessDefinitionThe definition registered under `$name`.
Parameters
| Name | Type | Description |
|---|---|---|
| $name | string |
Throws
\RuntimeException when no definition is registered under `$name`
ProcessDefinitionRegistry::names()
public function names(): arrayEvery registered definition's name, in registration order.