Skip to main content

PluginInfo

Trait PluginInfo 

Source
pub trait PluginInfo {
    // Required methods
    fn manifest(
        &mut self,
    ) -> impl Future<Output = Result<Manifest, CallError>> + Send;
    fn load_config(
        &mut self,
        streams: Vec<StreamConfig>,
        actions: Vec<ActionConfig>,
    ) -> impl Future<Output = RemoteResult<(Vec<StreamImpl>, Vec<ActionImpl>)>> + Send;
    fn start(&mut self) -> impl Future<Output = RemoteResult<()>> + Send;
    fn close(self) -> impl Future<Output = RemoteResult<()>> + Send;
}
Expand description

The only trait that must be implemented by a plugin. It provides lists of stream, filter and action types implemented by a dynamic plugin.

Required Methods§

Source

fn manifest( &mut self, ) -> impl Future<Output = Result<Manifest, CallError>> + Send

Return the manifest of the plugin. This should not be dynamic, and return always the same manifest.

Example implementation:

Ok(Manifest {
    hello: Hello::new(),
    streams: BTreeSet::from(["mystreamtype".into()]),
    actions: BTreeSet::from(["myactiontype".into()]),
})

First function called.

Source

fn load_config( &mut self, streams: Vec<StreamConfig>, actions: Vec<ActionConfig>, ) -> impl Future<Output = RemoteResult<(Vec<StreamImpl>, Vec<ActionImpl>)>> + Send

Load all plugin stream and action configurations. Must error if config is invalid.

The plugin should not start running mutable commands here: It should be ok to quit without cleanup for now.

Each StreamConfig from the streams arg should result in a corresponding StreamImpl returned, in the same order. Each ActionConfig from the actions arg should result in a corresponding ActionImpl returned, in the same order.

Function called after PluginInfo::manifest.

Source

fn start(&mut self) -> impl Future<Output = RemoteResult<()>> + Send

Notify the plugin that setup is finished, permitting a last occasion to report an error that’ll make reaction exit. All initialization (opening remote connections, starting streams, etc) should happen here.

Function called after PluginInfo::load_config.

Source

fn close(self) -> impl Future<Output = RemoteResult<()>> + Send

Notify the plugin that reaction is quitting and that the plugin should quit too. A few seconds later, the plugin will receive SIGTERM. A few seconds later, the plugin will receive SIGKILL.

Function called after PluginInfo::start, when reaction is quitting.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Codec> PluginInfo for PluginInfoClient<Codec>
where Codec: Codec,