Struct ockam::WorkerSystem
source · [−]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
sourceimpl<C: Send + 'static, M: Message> WorkerSystem<C, M>
impl<C: Send + 'static, M: Message> WorkerSystem<C, M>
sourcepub fn addresses(&self) -> Vec<Address>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn addresses(&self) -> Vec<Address>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Return the set of used addresses in this system
sourcepub fn attach<A, H>(&mut self, addr: A, handler: H) where
A: Into<Address>,
H: SystemHandler<C, M> + Send + 'static,
pub fn attach<A, H>(&mut self, addr: A, handler: H) where
A: Into<Address>,
H: SystemHandler<C, M> + Send + 'static,
Attach a system handler to this system
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
Trait Implementations
sourceimpl<C: Send + 'static, M: Message> Clone for WorkerSystem<C, M>
impl<C: Send + 'static, M: Message> Clone for WorkerSystem<C, M>
Auto Trait Implementations
impl<C, M> !RefUnwindSafe for WorkerSystem<C, M>
impl<C, M> Send for WorkerSystem<C, M>
impl<C, M> !Sync for WorkerSystem<C, M>
impl<C, M> Unpin for WorkerSystem<C, M>
impl<C, M> !UnwindSafe for WorkerSystem<C, M>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more