[][src]Struct wascc_host::WasccHost

pub struct WasccHost {}

Represents an instance of a waSCC host

Methods

impl WasccHost[src]

pub fn new() -> Self[src]

Creates a new waSCC runtime host

pub fn add_actor(&self, actor: Actor) -> Result<()>[src]

Adds an actor to the host

pub fn add_capability(
    &self,
    actor: Actor,
    binding: Option<&str>,
    wasi: WasiParams
) -> Result<()>
[src]

Adds a portable capability provider (WASI actor) to the waSCC host

pub fn remove_actor(&self, pk: &str) -> Result<()>[src]

Removes an actor from the host. Notifies the actor's processing thread to terminate, which will in turn attempt to unbind that actor from all previously bound capability providers

pub fn replace_actor(&self, new_actor: Actor) -> Result<()>[src]

Replaces one running actor with another live actor with no message loss. Note that the time it takes to perform this replacement can cause pending messages from capability providers (e.g. messages from subscriptions or HTTP requests) to build up in a backlog, so make sure the new actor can handle this stream of these delayed messages

pub fn add_middleware(&self, mid: impl Middleware)[src]

Adds a middleware item to the middleware processing pipeline

pub fn set_auth_hook<F>(&self, hook: F) where
    F: Fn(&Token<Actor>) -> bool + Sync + Send + 'static, 
[src]

Setting a custom authorization hook allows your code to make additional decisions about whether or not a given actor is allowed to run within the host. The authorization hook takes a Token (JSON Web Token) as input and returns a boolean indicating the validity of the module.

pub fn add_native_capability(&self, capability: NativeCapability) -> Result<()>[src]

Adds a native capability provider plugin to the waSCC runtime. Note that because these capabilities are native, cross-platform support is not always guaranteed.

pub fn remove_native_capability(
    &self,
    capability_id: &str,
    binding_name: Option<String>
) -> Result<()>
[src]

Removes a native capability provider plugin from the waSCC runtime

pub fn bind_actor(
    &self,
    actor: &str,
    capid: &str,
    binding_name: Option<String>,
    config: HashMap<String, String>
) -> Result<()>
[src]

Binds an actor to a capability provider with a given configuration. If the binding name is None then the default binding name will be used. An actor can only have one default binding per capability provider.

pub fn call_actor(
    &self,
    actor: &str,
    operation: &str,
    msg: &[u8]
) -> Result<Vec<u8>>
[src]

Invoke an operation handler on an actor directly. The caller is responsible for knowing ahead of time if the given actor supports the specified operation.

pub fn claims_for_actor(&self, pk: &str) -> Option<Claims<Actor>>[src]

Returns the full set of JWT claims for a given actor, if that actor is running in the host

pub fn actors(&self) -> Vec<SubjectClaimsPair>[src]

Returns the list of actors registered in the host

pub fn capabilities(&self) -> Vec<CapabilitySummary>[src]

Returns the list of capability providers registered in the host

Trait Implementations

impl Clone for WasccHost[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,