Struct quickwit_actors::ActorHandle
source · [−]pub struct ActorHandle<A: Actor> { /* private fields */ }
Expand description
An Actor Handle serves as an address to communicate with an actor.
Implementations
sourceimpl<A: Actor> ActorHandle<A>
impl<A: Actor> ActorHandle<A>
pub fn state(&self) -> ActorState
sourcepub async fn process_pending_and_observe(
&self
) -> Observation<A::ObservableState>
pub async fn process_pending_and_observe(
&self
) -> Observation<A::ObservableState>
Process all of the pending messages, and returns a snapshot of the observable state of the actor after this.
This method is mostly useful for tests.
To actually observe the state of an actor for ops purpose,
prefer using the .observe()
method.
This method timeout if reaching the end of the message takes more than an HEARTBEAT.
sourcepub async fn pause(&self)
pub async fn pause(&self)
Pauses the actor. The actor will stop processing the message, but its
work can be resumed by calling the method .resume()
.
sourcepub async fn kill(self) -> (ActorExitStatus, A::ObservableState)
pub async fn kill(self) -> (ActorExitStatus, A::ObservableState)
Kills the actor. Its finalize function will still be called.
This function also actionnates the actor kill switch.
The other difference with quit is the exit status. It is important, as the finalize logic may behave differently depending on the exit status.
sourcepub async fn quit(self) -> (ActorExitStatus, A::ObservableState)
pub async fn quit(self) -> (ActorExitStatus, A::ObservableState)
Gracefully quit the actor, regardless of whether there are pending messages or not. Its finalize function will be called.
The kill switch is not actionated.
The other difference with kill is the exit status. It is important, as the finalize logic may behave differently depending on the exit status.
sourcepub async fn join(self) -> (ActorExitStatus, A::ObservableState)
pub async fn join(self) -> (ActorExitStatus, A::ObservableState)
Waits until the actor exits by itself. This is the equivalent of Thread::join
.
sourcepub async fn observe(&self) -> Observation<A::ObservableState>
pub async fn observe(&self) -> Observation<A::ObservableState>
Observe the current state.
The observation will be scheduled as a command message, therefore it will be executed after the current active message and the current command queue have been processed.
pub fn last_observation(&self) -> A::ObservableState
pub fn mailbox(&self) -> &Mailbox<A>
Trait Implementations
sourceimpl<A: Actor> Debug for ActorHandle<A>
impl<A: Actor> Debug for ActorHandle<A>
sourceimpl<A: Actor> Supervisable for ActorHandle<A>
impl<A: Actor> Supervisable for ActorHandle<A>
Auto Trait Implementations
impl<A> !RefUnwindSafe for ActorHandle<A>
impl<A> Send for ActorHandle<A>
impl<A> Sync for ActorHandle<A>
impl<A> Unpin for ActorHandle<A> where
A: Unpin,
impl<A> !UnwindSafe for ActorHandle<A>
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>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more