Expand description
The actor’s local context
Implementations
sourceimpl<A: Actor<S>, S> Rt<A, S> where
Self: Send,
S: Send,
impl<A: Actor<S>, S> Rt<A, S> where
Self: Send,
S: Send,
sourcepub fn child<D: Into<String>>(&self, dir_name: D) -> LocateScopeId
pub fn child<D: Into<String>>(&self, dir_name: D) -> LocateScopeId
Start traversing from the child with the provided dir name
sourcepub fn parent(&self) -> LocateScopeId
pub fn parent(&self) -> LocateScopeId
Start traversing from the parent
sourcepub fn sibling<D: Into<String>>(&self, dir_name: D) -> LocateScopeId
pub fn sibling<D: Into<String>>(&self, dir_name: D) -> LocateScopeId
Start traversing from the sibling with the provided dir name
sourcepub fn grandparent(&self) -> LocateScopeId
pub fn grandparent(&self) -> LocateScopeId
Start traversing from the grand parent
sourcepub fn uncle<D: Into<String>>(&self, dir_name: D) -> LocateScopeId
pub fn uncle<D: Into<String>>(&self, dir_name: D) -> LocateScopeId
Start traversing from the uncle
sourcepub fn abortable<F>(&self, fut: F) -> Abortable<F>ⓘNotable traits for Abortable<Fut>impl<Fut> Future for Abortable<Fut> where
Fut: Future, type Output = Result<Fut::Output, Aborted>;
where
F: Future + Send + Sync,
pub fn abortable<F>(&self, fut: F) -> Abortable<F>ⓘNotable traits for Abortable<Fut>impl<Fut> Future for Abortable<Fut> where
Fut: Future, type Output = Result<Fut::Output, Aborted>;
where
F: Future + Send + Sync,
Fut: Future, type Output = Result<Fut::Output, Aborted>;
Create abortable future which will be aborted if the actor got shutdown signal.
sourcepub async fn start<Dir: Into<Option<String>>, Child>(
&mut self,
directory: Dir,
child: Child
) -> ActorResult<<Child::Channel as Channel>::Handle> where
Child: 'static + Actor<<A::Channel as Channel>::Handle> + ChannelBuilder<Child::Channel>,
<A::Channel as Channel>::Handle: SupHandle<Child>,
Self: Send,
pub async fn start<Dir: Into<Option<String>>, Child>(
&mut self,
directory: Dir,
child: Child
) -> ActorResult<<Child::Channel as Channel>::Handle> where
Child: 'static + Actor<<A::Channel as Channel>::Handle> + ChannelBuilder<Child::Channel>,
<A::Channel as Channel>::Handle: SupHandle<Child>,
Self: Send,
Spawn the provided child and await till it’s initialized
sourcepub async fn spawn<Dir: Into<Option<String>>, Child>(
&mut self,
directory: Dir,
child: Child
) -> ActorResult<(<Child::Channel as Channel>::Handle, InitializedRx)> where
<A::Channel as Channel>::Handle: Clone,
Child: 'static + ChannelBuilder<<Child as Actor<<A::Channel as Channel>::Handle>>::Channel> + Actor<<A::Channel as Channel>::Handle>,
Child::Channel: Send,
<Child as Actor<<A::Channel as Channel>::Handle>>::Channel: Send,
Dir: Into<Option<String>>,
<A::Channel as Channel>::Handle: SupHandle<Child>,
pub async fn spawn<Dir: Into<Option<String>>, Child>(
&mut self,
directory: Dir,
child: Child
) -> ActorResult<(<Child::Channel as Channel>::Handle, InitializedRx)> where
<A::Channel as Channel>::Handle: Clone,
Child: 'static + ChannelBuilder<<Child as Actor<<A::Channel as Channel>::Handle>>::Channel> + Actor<<A::Channel as Channel>::Handle>,
Child::Channel: Send,
<Child as Actor<<A::Channel as Channel>::Handle>>::Channel: Send,
Dir: Into<Option<String>>,
<A::Channel as Channel>::Handle: SupHandle<Child>,
Spawn the child, and returns its handle and initialized rx to check if it got initialized
sourcepub async fn start_with_channel<Dir: Into<Option<String>>, Child>(
&mut self,
directory: Dir,
child: Child,
channel: Child::Channel
) -> ActorResult<<Child::Channel as Channel>::Handle> where
Child: 'static + Actor<<A::Channel as Channel>::Handle>,
<A::Channel as Channel>::Handle: SupHandle<Child>,
Self: Send,
pub async fn start_with_channel<Dir: Into<Option<String>>, Child>(
&mut self,
directory: Dir,
child: Child,
channel: Child::Channel
) -> ActorResult<<Child::Channel as Channel>::Handle> where
Child: 'static + Actor<<A::Channel as Channel>::Handle>,
<A::Channel as Channel>::Handle: SupHandle<Child>,
Self: Send,
Spawn the provided child and await till it’s initialized
sourcepub async fn spawn_with_channel<Dir: Into<Option<String>>, Child>(
&mut self,
directory: Dir,
child: Child,
channel: Child::Channel
) -> ActorResult<(<Child::Channel as Channel>::Handle, InitializedRx)> where
<A::Channel as Channel>::Handle: Clone,
Child: 'static + Actor<<A::Channel as Channel>::Handle>,
Dir: Into<Option<String>>,
<A::Channel as Channel>::Handle: SupHandle<Child>,
pub async fn spawn_with_channel<Dir: Into<Option<String>>, Child>(
&mut self,
directory: Dir,
child: Child,
channel: Child::Channel
) -> ActorResult<(<Child::Channel as Channel>::Handle, InitializedRx)> where
<A::Channel as Channel>::Handle: Clone,
Child: 'static + Actor<<A::Channel as Channel>::Handle>,
Dir: Into<Option<String>>,
<A::Channel as Channel>::Handle: SupHandle<Child>,
Spawn the child, and returns its handle and initialized rx to check if it got initialized
sourcepub fn upsert_microservice(&mut self, scope_id: ScopeId, service: Service)
pub fn upsert_microservice(&mut self, scope_id: ScopeId, service: Service)
Insert/Update microservice. Note: it will remove the children handles/joins if the provided service is stopped and store entry for it in inactive if does have directory
sourcepub fn remove_microservice(&mut self, scope_id: ScopeId)
pub fn remove_microservice(&mut self, scope_id: ScopeId)
Remove the microservice microservice under the provided scope_id
sourcepub fn inbox_mut(&mut self) -> &mut <A::Channel as Channel>::Inbox
pub fn inbox_mut(&mut self) -> &mut <A::Channel as Channel>::Inbox
Returns mutable reference to the actor’s inbox
sourcepub fn handle_mut(&mut self) -> &mut <A::Channel as Channel>::Handle
pub fn handle_mut(&mut self) -> &mut <A::Channel as Channel>::Handle
Returns mutable reference to the actor’s handle
sourcepub fn handle(&self) -> &<A::Channel as Channel>::Handle
pub fn handle(&self) -> &<A::Channel as Channel>::Handle
Returns immutable reference to the actor’s handle
sourcepub fn supervisor_handle_mut(&mut self) -> &mut S
pub fn supervisor_handle_mut(&mut self) -> &mut S
Returns mutable reference to the actor’s supervisor handle
sourcepub fn supervisor_handle(&self) -> &S
pub fn supervisor_handle(&self) -> &S
Returns immutable reference to the actor’s supervisor handle
sourcepub async fn shutdown_scope(&self, scope_id: ScopeId) -> Result<()> where
Self: Send,
pub async fn shutdown_scope(&self, scope_id: ScopeId) -> Result<()> where
Self: Send,
Shutdown the scope under the provided scope_id
sourcepub fn microservices_stopped(&self) -> bool
pub fn microservices_stopped(&self) -> bool
Check if microservices are stopped
sourcepub fn microservices_all(&self, are: fn(_: &Service) -> bool) -> bool
pub fn microservices_all(&self, are: fn(_: &Service) -> bool) -> bool
Check if all microservices are _
sourcepub fn microservices_any(&self, is: fn(_: &Service) -> bool) -> bool
pub fn microservices_any(&self, is: fn(_: &Service) -> bool) -> bool
Check if any microservice is _
sourcepub async fn shutdown_children(&mut self)
pub async fn shutdown_children(&mut self)
Shutdown all the children within this actor context
sourcepub async fn shutdown_child(
&mut self,
child_scope_id: &ScopeId
) -> Option<JoinHandle<ActorResult<()>>>
pub async fn shutdown_child(
&mut self,
child_scope_id: &ScopeId
) -> Option<JoinHandle<ActorResult<()>>>
Shutdown child using its scope_id
sourcepub async fn shutdown_children_type<T: 'static + Actor<<A::Channel as Channel>::Handle>>(
&mut self
) -> HashMap<ScopeId, JoinHandle<ActorResult<()>>> where
<A::Channel as Channel>::Handle: SupHandle<T>,
pub async fn shutdown_children_type<T: 'static + Actor<<A::Channel as Channel>::Handle>>(
&mut self
) -> HashMap<ScopeId, JoinHandle<ActorResult<()>>> where
<A::Channel as Channel>::Handle: SupHandle<T>,
Shutdown all the children of a given type within this actor context
sourcepub async fn add_route<T: Send + 'static>(&self) -> Result<()> where
<A::Channel as Channel>::Handle: Route<T>,
pub async fn add_route<T: Send + 'static>(&self) -> Result<()> where
<A::Channel as Channel>::Handle: Route<T>,
Add route for T
sourcepub async fn remove_route<T: Send + 'static>(&self) -> Result<()>
pub async fn remove_route<T: Send + 'static>(&self) -> Result<()>
Remove route of T
sourceimpl<A: Actor<S>, S: SupHandle<A>> Rt<A, S> where
Self: Send,
impl<A: Actor<S>, S: SupHandle<A>> Rt<A, S> where
Self: Send,
sourcepub async fn update_status(&mut self, service_status: ServiceStatus)
pub async fn update_status(&mut self, service_status: ServiceStatus)
Update the service status, and report to the supervisor and subscribers (if any)
sourceimpl<A: Actor<S>, S: SupHandle<A>> Rt<A, S>
impl<A: Actor<S>, S: SupHandle<A>> Rt<A, S>
sourcepub fn new(
depth: usize,
service: Service,
scopes_index: usize,
scope_id: ScopeId,
parent_scope_id: Option<ScopeId>,
sup_handle: S,
handle: <A::Channel as Channel>::Handle,
inbox: <A::Channel as Channel>::Inbox,
abort_registration: AbortRegistration,
visible_data: HashSet<TypeId>
) -> Self
pub fn new(
depth: usize,
service: Service,
scopes_index: usize,
scope_id: ScopeId,
parent_scope_id: Option<ScopeId>,
sup_handle: S,
handle: <A::Channel as Channel>::Handle,
inbox: <A::Channel as Channel>::Inbox,
abort_registration: AbortRegistration,
visible_data: HashSet<TypeId>
) -> Self
Create Overclock context
sourceimpl<A: Actor<S>, S: SupHandle<A>> Rt<A, S>
impl<A: Actor<S>, S: SupHandle<A>> Rt<A, S>
sourcepub async fn add_resource<T: Resource>(&mut self, resource: T)
pub async fn add_resource<T: Resource>(&mut self, resource: T)
Add exposed resource
sourcepub async fn highest_scope_id<T: Resource>(&self) -> Option<ScopeId>
pub async fn highest_scope_id<T: Resource>(&self) -> Option<ScopeId>
Get the highest resource’s scope id (at the most top level) for a given global visiable resource
sourcepub async fn lowest_scope_id<T: Resource>(&self) -> Option<ScopeId>
pub async fn lowest_scope_id<T: Resource>(&self) -> Option<ScopeId>
Gets the lowest resource’s scope id for a given global visiable resource
sourcepub async fn try_borrow<'a, T: Resource, R>(
&self,
resource_scope_id: ScopeId,
fn_once: fn(_: &T) -> R
) -> Option<R::Output> where
R: Future + Send + 'static,
pub async fn try_borrow<'a, T: Resource, R>(
&self,
resource_scope_id: ScopeId,
fn_once: fn(_: &T) -> R
) -> Option<R::Output> where
R: Future + Send + 'static,
Try to borrow resource and invoke fn_once
sourcepub async fn try_borrow_mut<'a, T: Resource, R>(
&self,
resource_scope_id: ScopeId,
fn_once: fn(_: &T) -> R
) -> Option<R::Output> where
R: Future + Send + 'static,
pub async fn try_borrow_mut<'a, T: Resource, R>(
&self,
resource_scope_id: ScopeId,
fn_once: fn(_: &T) -> R
) -> Option<R::Output> where
R: Future + Send + 'static,
Try to borrow_mut the resource and invoke fn_once
sourcepub async fn lookup<T: Resource>(&self, resource_scope_id: ScopeId) -> Option<T>
pub async fn lookup<T: Resource>(&self, resource_scope_id: ScopeId) -> Option<T>
Lookup for resource T under the provider scope_id
sourcepub async fn remove_resource<T: Resource>(&self) -> Option<T>
pub async fn remove_resource<T: Resource>(&self) -> Option<T>
Remove the resource, and inform the interested dyn subscribers
sourcepub async fn depends_on<T: Resource>(
&self,
resource_scope_id: ScopeId
) -> Result<T, Error>
pub async fn depends_on<T: Resource>(
&self,
resource_scope_id: ScopeId
) -> Result<T, Error>
Depends on resource T, it will await/block till the resource is available
sourcepub async fn link<T: Resource>(
&self,
resource_scope_id: ScopeId,
hard_link: bool
) -> Result<T, Error>
pub async fn link<T: Resource>(
&self,
resource_scope_id: ScopeId,
hard_link: bool
) -> Result<T, Error>
Link to resource, which will await till it’s available. NOTE: similar to depends_on, but only shutdown self actor if the resource got dropped hard_link: if shutdown the subscriber when the publisher publishes a new copy
Auto Trait Implementations
impl<A, S> !RefUnwindSafe for Rt<A, S>
impl<A, S> Send for Rt<A, S>
impl<A, S> Sync for Rt<A, S> where
S: Sync,
impl<A, S> Unpin for Rt<A, S> where
S: Unpin,
<<A as Actor<S>>::Channel as Channel>::Handle: Unpin,
<<A as Actor<S>>::Channel as Channel>::Inbox: Unpin,
impl<A, S> !UnwindSafe for Rt<A, S>
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