[][src]Trait wascc_codec::capabilities::CapabilityProvider

pub trait CapabilityProvider: Any + Send + Sync {
    fn configure_dispatch(
        &self,
        dispatcher: Box<dyn Dispatcher>
    ) -> Result<(), Box<dyn Error>>;
fn capability_id(&self) -> &'static str;
fn name(&self) -> &'static str;
fn handle_call(
        &self,
        actor: &str,
        op: &str,
        msg: &[u8]
    ) -> Result<Vec<u8>, Box<dyn Error>>; }

Every capability provider must implement this trait

Required methods

fn configure_dispatch(
    &self,
    dispatcher: Box<dyn Dispatcher>
) -> Result<(), Box<dyn Error>>

This function will be called on the provider when the host runtime is ready and has configured a dispatcher. This function is only ever called once for a capability provider, regardless of the number of actors being managed in the host

fn capability_id(&self) -> &'static str

The capability provider will return either one of the well-known capability IDs or a custom capability ID using namespace:id notation

fn name(&self) -> &'static str

The human-readable, friendly name of this capability provider. By convention, the provider should include information about the specific implementation, e.g. contain the name "Redis" for a K/V store or "NATS" for a message broker.

fn handle_call(
    &self,
    actor: &str,
    op: &str,
    msg: &[u8]
) -> Result<Vec<u8>, Box<dyn Error>>

This function is called by the host runtime when an actor module requests an operation be executed by the capability provider

Loading content...

Implementors

Loading content...