pub struct WorkerSystem<C: Send + 'static, M: Message> { /* private fields */ }
Expand description

A composable worker system type.

A worker system is a single worker which can act as a full cluster of workers. This is achieved via the send_to_self(...) API endpoint on the Ockam Node API.

The worker system also provides some utilities for creating and managing mappings between hidden API-addresses and behaviour hooks associated to each address.

The advantage of a worker system over a full set of workers is a lower memory overhead for resource constrained devices.

Implementations

Check whether this system has registered handlers

Return the set of used addresses in this system

Attach a system handler to this system

Attach a boxed system handler to this system

source

pub fn set_entry<A: Into<Address>>(&mut self, addr: A)

Specify an “entry point” address for this system

Because a worker system is a graph of relationships between ‘SystemHandler’ instances it may be hard to determine which instance to send a message to first. The pre-configuration phase of a worker system can determine this address and store it as the entry-point.

You can then start the handling process by calling dispatch_entry().

Get an optional reference to the entry point of this system

source

pub async fn dispatch_entry(
    &mut self,
    ctx: &mut C,
    msg: Routed<M>
) -> Result<()>

Dispatch a message to the pre-configured system entry point

This function returns an error if no entry point was configured or the configured address was not bound.

Handle a message via this worker system

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more