Skip to main content

FactoryMessage

Enum FactoryMessage 

Source
pub enum FactoryMessage<TKey, TMsg>
where TKey: JobKey, TMsg: Message,
{ Dispatch(Job<TKey, TMsg>), Finished(usize, TKey), DoPings(Instant), Calculate, WorkerPong(usize, Duration), IdentifyStuckWorkers, GetQueueDepth(RpcReplyPort<usize>), AdjustWorkerPool(usize), GetAvailableCapacity(RpcReplyPort<usize>), GetNumActiveWorkers(RpcReplyPort<usize>), DrainRequests, UpdateSettings(UpdateSettingsRequest<TKey, TMsg>), }
Expand description

Messages to a factory.

A special note about factory messages in a distributed context!

Factories only support the command FactoryMessage::Dispatch over a cluster configuration as the rest of the message types are internal and only intended for in-host communication. This means if you’re communicating to a factory you would send only a serialized Job which would automatically be converted to a [FactoryMessage::Dispatch(Job)]

Variants§

§

Dispatch(Job<TKey, TMsg>)

Dispatch a new message

§

Finished(usize, TKey)

A job finished

§

DoPings(Instant)

Send a ping to the workers of the factory along with tracking the factory’s timing itself

§

Calculate

Calculate factory properties (loadshedding, concurrency, etc)

§

WorkerPong(usize, Duration)

A reply to a factory ping supplying the worker id and the time of the ping start

§

IdentifyStuckWorkers

Trigger a scan for stuck worker detection

§

GetQueueDepth(RpcReplyPort<usize>)

Retrieve the current queue depth (if in a queueing mode)

§

AdjustWorkerPool(usize)

Resize the worker pool to the requested size

§

GetAvailableCapacity(RpcReplyPort<usize>)

Retrieve the available capacity of the worker pool + queue

§

GetNumActiveWorkers(RpcReplyPort<usize>)

Instantaneous measurement of the number of currently processing requests

§

DrainRequests

Notify the factory that it’s being drained, and to finish jobs currently in the queue, but discard new work, and once drained exit

NOTE: This is different from draining the actor itself, which allows the pending message queue to flush and then exit. Since the factory holds an internal queue for jobs, it’s possible that the internal state still has work to do while the factory’s input queue is drained. Therefore in order to propertly drain a factory, you should use the DrainRequests version so the internal pending queue is properly flushed.

§

UpdateSettings(UpdateSettingsRequest<TKey, TMsg>)

Dynamically update the factory’s settings, for those which don’t require strong-type guarantees. This allows, at runtime, changing the

  • Worker Count
  • Discard Settings
  • Lifecycle Hooks
  • Statistics collection
  • Capacity controller
  • Dead-man’s switch
  • Discard handler

Trait Implementations§

Source§

impl<TKey, TMsg> Debug for FactoryMessage<TKey, TMsg>
where TKey: Debug + JobKey, TMsg: Debug + Message,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<TKey, TMsg> Freeze for FactoryMessage<TKey, TMsg>
where TKey: Freeze, TMsg: Freeze,

§

impl<TKey, TMsg> !RefUnwindSafe for FactoryMessage<TKey, TMsg>

§

impl<TKey, TMsg> Send for FactoryMessage<TKey, TMsg>

§

impl<TKey, TMsg> Sync for FactoryMessage<TKey, TMsg>
where TMsg: Sync,

§

impl<TKey, TMsg> Unpin for FactoryMessage<TKey, TMsg>
where TKey: Unpin, TMsg: Unpin,

§

impl<TKey, TMsg> UnsafeUnpin for FactoryMessage<TKey, TMsg>
where TKey: UnsafeUnpin, TMsg: UnsafeUnpin,

§

impl<TKey, TMsg> !UnwindSafe for FactoryMessage<TKey, TMsg>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Message for T
where T: Any + Send + 'static,

Source§

fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>

Convert a BoxedMessage to this concrete type
Source§

fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>

Convert this message to a BoxedMessage
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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<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> State for T
where T: Any + Send + 'static,