Struct ockam::WorkerSystem
source · 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§
source§impl<C: Send + 'static, M: Message> WorkerSystem<C, M>
impl<C: Send + 'static, M: Message> WorkerSystem<C, M>
sourcepub fn attach_boxed<A: Into<Address>>(
&mut self,
addr: A,
handler: Box<dyn SystemHandler<C, M> + Send + 'static>
)
pub fn attach_boxed<A: Into<Address>>( &mut self, addr: A, handler: Box<dyn SystemHandler<C, M> + Send + 'static> )
Attach a boxed system handler to this system
sourcepub fn set_entry<A: Into<Address>>(&mut self, addr: A)
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()
.
sourcepub fn entrypoint(&self) -> Option<&Address>
pub fn entrypoint(&self) -> Option<&Address>
Get an optional reference to the entry point of this system