Skip to main content

Module role

Module role 

Source
Expand description

Process role and placement — the master/worker contract (phase 79).

Folk’s runtime model is fork-after-warm: a single-threaded master process warms PHP + bootstraps the framework, then fork()s N worker processes. The master never executes PHP — it supervises (respawn, per-worker memory, force-kill) and owns shared state (the metrics shared-memory segment, the in-memory jobs queue). Each worker owns its requests end-to-end and dispatches into the PHP of its own process.

A plugin therefore needs to know two things:

  • where it runs — declared up front via [Plugin::placement]; the core only boots a plugin in the process(es) its placement names;
  • which process it is in right now — observed at boot via PluginContext::role, so a Both plugin can branch on master vs worker behaviour.

Enums§

Placement
Where a plugin should be booted in the fork-after-warm model.
PluginRole
Which process a plugin instance is executing in.