Skip to main content

Module plugins

Module plugins 

Source
Expand description

The laterite.plugins built-in module: a registry table recording each plugin’s operator enable/disable state, read at boot to decide which plugins load. record_roster records the compiled plugins here at boot, set_enabled is the enable/disable service (applied on the next boot), and list_plugins feeds the admin screen. The quarantined_* columns hold the system’s verdict (written by a later slice).

The admin screen (index, toggle) lists the roster and lets an operator flip a plugin on or off; the change is an intent stored here and applied on the next boot, so the screen says so plainly.

Structs§

PluginRow
A plugin’s registry row, for the admin screen.
PluginsModule
The built-in module owning the plugin-registry table.
ReconcileReport
What reconcile_boot changed, for the boot log.

Constants§

CRASH_REASON
Reason recorded when a plugin is auto-quarantined because its init crashed the previous boot (a crash no catch_unwind could catch).
MODULE_ID
Stable id of this built-in module.

Functions§

binary_fingerprint
Fingerprint of the running binary (its size and modification time): stable across restarts of the same executable, changed by a rebuild or redeploy. The journal uses it to tell “the same binary crashed again” from “a new binary may be fixed”. Falls back to a constant when the executable cannot be inspected.
clear_loading
Clears the load marker once a plugin’s init has succeeded.
disabled_ids
The plugin ids an operator has disabled (rows with enabled false). An absent row means enabled, so a fresh install disables nothing.
list_plugins
Every registered plugin with its state, ordered by id, for the admin screen.
mark_loading
Durably records that plugin_id’s init is about to run under fingerprint. Written before the plugin migrates or registers, so a hard crash leaves the marker for the next boot’s reconcile_boot to find.
quarantine
Persists a quarantine against plugin_id: the reason, the time, and the binary fingerprint it failed under (so a later, different binary lifts it). Also clears any load marker, since the attempt is now resolved. A quarantined plugin is skipped at boot until it is re-enabled or the binary changes.
quarantined
The ids and reasons of currently-quarantined plugins. The boot skips these and reports the reason.
reconcile_boot
Reconciles the journal against the current binary fingerprint at boot, before deciding what loads:
record_roster
Records the compiled plugins, inserting an enabled row for any not seen before and leaving existing rows (and their operator state) untouched. Called at boot so the table is the full plugin roster the admin screen lists.
set_enabled
Sets a plugin’s operator enable/disable state (upsert). Takes effect on the next boot: a disabled plugin is skipped, an enabled one migrates and registers.