Expand description
Plug-in API and ABI surface for NautilusTrader.
This crate defines the C-ABI boundary between a Nautilus host (the live node) and
independently compiled Rust plug-in cdylibs. Plug-ins ship a single
nautilus_plugin_init symbol and a 'static PluginManifest; the host
dlopens the library, calls the entry point, and registers every plug point
the manifest enumerates.
§Layout
Infrastructure modules describe how plug-ins work at the boundary:
boundary: primitive#[repr(C)]types used at the boundary (BorrowedStr,Slice,PluginError, etc.).manifest: the static manifest a plug-in returns and the per-plug-point registration entries it contains.host: theHostVTableof function pointers the host gives to the plug-in for re-entrant callbacks (msgbus, clock, logging, etc.).panic: acatch_unwindwrapper that every macro-generated thunk uses to stop a plug-in panic from unwinding across the FFI boundary.
Per-plug-point trait surfaces live under surfaces:
surfaces::custom_data: custom data type plug-point.surfaces::actor: plug-in actor (DataActor-shaped) plug-point.surfaces::strategy: plug-in strategy (Strategy-shaped) plug-point.surfaces::controller: controller plug-point with prepare hooks and runtime strategy-control host services.
Host-side loading lives behind the host feature and uses libloading.
Re-exports§
pub use boundary::BorrowedStr;pub use boundary::OwnedBytes;pub use boundary::PluginError;pub use boundary::PluginErrorCode;pub use boundary::PluginResult;pub use boundary::Slice;pub use host::ControllerHostContext;pub use host::ControllerHostVTable;pub use host::HostContext;pub use host::HostVTable;pub use manifest::ActorRegistration;pub use manifest::ControllerRegistration;pub use manifest::CustomDataRegistration;pub use manifest::PluginBuildId;pub use manifest::PluginInitFn;pub use manifest::PluginManifest;pub use manifest::StrategyRegistration;pub use manifest::ValidatedActorRegistration;pub use manifest::ValidatedActorVTable;pub use manifest::ValidatedControllerRegistration;pub use manifest::ValidatedControllerVTable;pub use manifest::ValidatedCustomDataRegistration;pub use manifest::ValidatedCustomDataVTable;pub use manifest::ValidatedPluginManifest;pub use manifest::ValidatedStrategyRegistration;pub use manifest::ValidatedStrategyVTable;pub use surfaces::actor::PluginActor;pub use surfaces::controller::PluginController;pub use surfaces::custom_data::PluginCustomData;pub use surfaces::custom_data::PluginCustomDataRef;pub use surfaces::strategy::PluginStrategy;
Modules§
- boundary
- Primitive
#[repr(C)]types used at the plug-in boundary. - bridge
- Host-side bridge between the plug-in C ABI and an engine.
- host
- Host-side function table given to plug-ins for re-entrant callbacks.
- loader
- Host-side plug-in loader.
- manifest
- Static manifest a plug-in returns from
nautilus_plugin_init. - panic
- Catch-unwind wrapper used by every plug-in
extern "C"thunk. - prelude
- Re-exports that plug-in authors typically want in scope.
- surfaces
- Plug-point trait surfaces.
Macros§
- nautilus_
plugin - Defines a plug-in’s static manifest and emits the
nautilus_plugin_initentry symbol.
Constants§
- NAUTILUS_
PLUGIN_ ABI_ VERSION - ABI version of the plug-in contract.
- NAUTILUS_
PLUGIN_ INIT_ SYMBOL - Name of the single
extern "C"entry symbol every plug-in cdylib must export. - PLUGIN_
BUILD_ ID_ VERSION - Schema version for
manifest::PluginBuildId.