pub struct WorkerSender<T> {
pub(crate) inner: Sender<T>,
pub(crate) worker_id: u32,
pub(crate) hostname: String,
pub(crate) status: Arc<Mutex<WorkerStatus>>,
pub(crate) unicast_v4: Option<Address>,
pub(crate) unicast_v6: Option<Address>,
}Expand description
Special Sender struct for workers that sends tasks after a delay (based on the Worker interval).
Fields§
§inner: Sender<T>Inner sender that connects to the orker
worker_id: u32Unique Worker ID
hostname: StringWorker hostname
status: Arc<Mutex<WorkerStatus>>Status of the Worker (e.g., Listening, Probing, Idle, Connected)
unicast_v4: Option<Address>Unicast IPv4 address of the Worker (None if unavailable)
unicast_v6: Option<Address>Unicast IPv6 address of the Worker (None if unavailable)
Implementations§
Source§impl<T> WorkerSender<T>
impl<T> WorkerSender<T>
Sourcepub async fn send(&self, task: T) -> Result<(), SendError<T>>
pub async fn send(&self, task: T) -> Result<(), SendError<T>>
Sends an instruction to the worker. On failure, logs a warning (once) and marks the worker as disconnected.
Sourcepub fn try_send(&self, task: T) -> Result<(), TrySendError<T>>
pub fn try_send(&self, task: T) -> Result<(), TrySendError<T>>
Sends an instruction to the worker without blocking
pub fn is_participating(&self) -> bool
pub fn get_status(&self) -> WorkerStatus
Trait Implementations§
Source§impl<T: Clone> Clone for WorkerSender<T>
impl<T: Clone> Clone for WorkerSender<T>
Source§fn clone(&self) -> WorkerSender<T>
fn clone(&self) -> WorkerSender<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for WorkerSender<T>
impl<T> RefUnwindSafe for WorkerSender<T>
impl<T> Send for WorkerSender<T>where
T: Send,
impl<T> Sync for WorkerSender<T>where
T: Send,
impl<T> Unpin for WorkerSender<T>
impl<T> UnsafeUnpin for WorkerSender<T>
impl<T> UnwindSafe for WorkerSender<T>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].