Skip to main content

Module serve

Module serve 

Source
Expand description

The loop of a plugin (docs/PLUGINS.md §3, PLG-2), asynchronous: JSON-RPC 2.0, one message a line. Each request is answered when it ends, several at once (a slow call does not hold back the others); a batch is answered as a batch. While it answers, the plugin may ask Escouade (Cx::request: its secrets, its settings) and write to its journal (Cx::log). initialize and shutdown are answered here.

The same Plugin and the same Cx on both targets. In process, the loop is on tokio’s threads (process); in a module, a reactor on one thread, without tokio (reactor, docs/PLUGINS.md §8.3).

Structs§

Cx
What a call may ask of Escouade while it runs.
Refusal
A refusal: its code and its message (escouade_plugin_protocol::code). A refusal: its code and its message.

Traits§

Plugin
A plugin: what it can do, and its answer to each method but the handshake’s.

Functions§

run
The whole life of a plugin of escouade-plugins: its language, then its loop on the standard input and output, on a runtime of its own. Its exit code.
serve_on
Runs plugin on input and output until input ends or shutdown is answered.