[][src]Trait gary_core::plugins::runtime::RuntimePlugin

pub trait RuntimePlugin: Any + Send + Sync {
    fn name(&self) -> String;
fn get_features(&self) -> Vec<RuntimeFeatures>;
fn get_version(&self) -> i32;
fn create_workload(
        &self,
        id: String,
        config: &RuntimeConfig,
        options: &Option<SandboxConfig>
    ) -> Result<String, RuntimeError>;
fn start_workload(&mut self, id: String) -> Option<RuntimeError>;
fn stop_workload(&self, id: String, timeout: i32) -> Option<RuntimeError>;
fn remove_workload(&self, id: String) -> Option<RuntimeError>;
fn status_workload(
        &self,
        id: String
    ) -> Result<WorkloadStatus, RuntimeError>;
fn update_workload_resources(
        &self,
        id: String,
        rez: WorkloadResources
    ) -> Option<RuntimeError>;
fn exec_sync(
        &self,
        id: String,
        cmd: &[String],
        timeout: i32
    ) -> (&[u8], &[u8], Option<RuntimeError>); fn on_plugin_load(&self) { ... }
fn on_plugin_unload(&self) { ... } }

A trait for plugins that run workloads Any unimplemented function should return RuntimeErrors::Unimplemented as this is used internally to ensure functionality of the plugin.

Required methods

fn name(&self) -> String

The name of the plugin used to identify it.

fn get_features(&self) -> Vec<RuntimeFeatures>

fn get_version(&self) -> i32

fn create_workload(
    &self,
    id: String,
    config: &RuntimeConfig,
    options: &Option<SandboxConfig>
) -> Result<String, RuntimeError>

fn start_workload(&mut self, id: String) -> Option<RuntimeError>

fn stop_workload(&self, id: String, timeout: i32) -> Option<RuntimeError>

fn remove_workload(&self, id: String) -> Option<RuntimeError>

fn status_workload(&self, id: String) -> Result<WorkloadStatus, RuntimeError>

fn update_workload_resources(
    &self,
    id: String,
    rez: WorkloadResources
) -> Option<RuntimeError>

fn exec_sync(
    &self,
    id: String,
    cmd: &[String],
    timeout: i32
) -> (&[u8], &[u8], Option<RuntimeError>)

Loading content...

Provided methods

fn on_plugin_load(&self)

A callback fired immediately after the plugin is loaded. Usually used for initialization.

fn on_plugin_unload(&self)

A callback fired immediately before the plugin is unloaded. Use this if you need to do any cleanup.

Loading content...

Implementors

Loading content...