cordis-loader
Config-file driven plugin loader for the cordis-rs plugin framework.
This crate is the assembly half of porting upstream Cordis' loader: it
connects cordis-include entry
trees to cordis fibers and re-exports everything needed on top
(cordis-include, cordis-group), so applications depend on this crate
alone.
┌─ cordis-loader ← this crate: plugin registry + fiber state machine
├─ cordis-group group plugin (nesting marker)
├─ cordis-include entry trees + config files
└─ cordis-rs core runtime (zero dependencies)
Example
use ;
use ;
use ;
#
Imports
An entry with name: import and config: { url: "…" } mounts another
config file as its subtree — same diff machinery, same id reuse:
# main.yml
entries:
- id: extra
name: import
config:
url: extra.yml
# extra.yml — entries become children of `extra`
entries:
- id: adapter
name: adapter-http
Reloads compose all involved files into one tree diff; write-back always
routes mounted entries back to the file they came from (generated ids
included). Import cycles are reported via last_error() and skipped.
What the state machine does
- open — read (or create) the entry file, build the tree, start every enabled entry; group children start beneath their group fiber's context, so disposing a group cascades.
- reload — re-read the file under a suspend guard and reconcile: created entries start, removed subtrees stop, moved entries restart under their new parent, config-only changes patch in place. Generated ids are persisted afterwards so the next reload matches them.
- self-kill — a fiber that reaches
Disposedoutside loader operation was killed by its own plugin; the loader persistsdisabled: truefor that entry. Removing an entry from the file just stops it. - inject — an entry's
injectlist is merged into the plugin's own declaration, so services going away or coming back reconciles entries through the core machinery. - update_config — the runtime entry point for changing config: updates the fiber and persists to the file.
Feature flags
watch— hot reload: wiresLoaderFile's debounced watcher toLoader::reload. Reload errors are recorded inlast_error().
The cordis-cli runner builds its
cordis run command on top of this crate.