quickwit_actors

Struct ActorHandle

Source
pub struct ActorHandle<A: Actor> { /* private fields */ }
Expand description

An Actor Handle serves as an address to communicate with an actor.

Implementations§

Source§

impl<A: Actor> ActorHandle<A>

Source

pub fn state(&self) -> ActorState

Source

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.

Source

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().

Source

pub async fn resume(&self)

Resumes a paused actor.

Source

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.

Source

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.

Source

pub async fn join(self) -> (ActorExitStatus, A::ObservableState)

Waits until the actor exits by itself. This is the equivalent of Thread::join.

Source

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.

Source

pub fn last_observation(&self) -> A::ObservableState

Source

pub fn mailbox(&self) -> &Mailbox<A>

Trait Implementations§

Source§

impl<A: Actor> Debug for ActorHandle<A>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A: Actor> Supervisable for ActorHandle<A>

Source§

fn name(&self) -> &str

Source§

fn health(&self) -> Health

Auto Trait Implementations§

§

impl<A> Freeze for ActorHandle<A>

§

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§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T