pub struct WorkerServerState {
pub heartbeat_state: Option<Arc<HeartbeatState>>,
pub connected: Arc<Mutex<bool>>,
pub worker_id: Arc<Mutex<Option<String>>>,
/* private fields */
}Expand description
Worker server state shared across handlers
Fields§
§heartbeat_state: Option<Arc<HeartbeatState>>Heartbeat state from the worker (used to determine readiness)
connected: Arc<Mutex<bool>>Whether the SSE stream is currently connected
worker_id: Arc<Mutex<Option<String>>>Worker ID for identification
Implementations§
Source§impl WorkerServerState
impl WorkerServerState
pub fn new() -> Self
Sourcepub async fn set_task_notification_channel(&self, tx: Sender<String>)
pub async fn set_task_notification_channel(&self, tx: Sender<String>)
Set the task notification channel (called from worker)
Sourcepub async fn notify_new_task(&self, task_id: &str)
pub async fn notify_new_task(&self, task_id: &str)
Notify worker of a new task (called from /task endpoint)
pub fn with_heartbeat(self, state: Option<Arc<HeartbeatState>>) -> Self
Sourcepub async fn set_heartbeat_state(&self, state: Arc<HeartbeatState>)
pub async fn set_heartbeat_state(&self, state: Arc<HeartbeatState>)
Set the heartbeat state (called from worker)
Sourcepub async fn heartbeat_state(&self) -> Arc<HeartbeatState>
pub async fn heartbeat_state(&self) -> Arc<HeartbeatState>
Get the heartbeat state (for HTTP server)
pub async fn set_connected(&self, connected: bool)
pub async fn set_worker_id(&self, worker_id: String)
pub async fn worker_id(&self) -> String
pub async fn is_connected(&self) -> bool
pub async fn is_ready(&self) -> bool
Trait Implementations§
Source§impl Clone for WorkerServerState
impl Clone for WorkerServerState
Source§fn clone(&self) -> WorkerServerState
fn clone(&self) -> WorkerServerState
Returns a duplicate of the value. Read more
1.0.0 · 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 Freeze for WorkerServerState
impl !RefUnwindSafe for WorkerServerState
impl Send for WorkerServerState
impl Sync for WorkerServerState
impl Unpin for WorkerServerState
impl !UnwindSafe for WorkerServerState
Blanket Implementations§
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more