pub struct TaskRegistry { /* private fields */ }Expand description
In-memory registry of tasks and runs for the scheduler.
This is a lightweight state cache — the event store remains the source of truth. The registry lets the scheduler make fast decisions without querying the store.
Implementations§
Source§impl TaskRegistry
impl TaskRegistry
pub fn new() -> Self
Sourcepub fn get_task_mut(&mut self, task_id: &TaskId) -> Option<&mut Task>
pub fn get_task_mut(&mut self, task_id: &TaskId) -> Option<&mut Task>
Get a mutable task by ID.
Sourcepub fn get_run_mut(&mut self, run_id: &RunId) -> Option<&mut Run>
pub fn get_run_mut(&mut self, run_id: &RunId) -> Option<&mut Run>
Get a mutable run by ID.
Sourcepub fn is_task_complete(&self, task_id: &TaskId) -> bool
pub fn is_task_complete(&self, task_id: &TaskId) -> bool
Check if a task is complete.
Sourcepub fn tasks_for_run(&self, run_id: &RunId) -> Vec<&Task>
pub fn tasks_for_run(&self, run_id: &RunId) -> Vec<&Task>
Get all tasks for a run.
Sourcepub fn track_lease(&mut self, queue_id: Uuid, task_id: TaskId)
pub fn track_lease(&mut self, queue_id: Uuid, task_id: TaskId)
Track an active lease.
Sourcepub fn remove_lease(&mut self, queue_id: &Uuid) -> Option<TaskId>
pub fn remove_lease(&mut self, queue_id: &Uuid) -> Option<TaskId>
Remove a tracked lease.
Sourcepub fn active_lease_ids(&self) -> Vec<Uuid>
pub fn active_lease_ids(&self) -> Vec<Uuid>
Get all active lease queue_ids.
Trait Implementations§
Source§impl Debug for TaskRegistry
impl Debug for TaskRegistry
Auto Trait Implementations§
impl Freeze for TaskRegistry
impl RefUnwindSafe for TaskRegistry
impl Send for TaskRegistry
impl Sync for TaskRegistry
impl Unpin for TaskRegistry
impl UnsafeUnpin for TaskRegistry
impl UnwindSafe for TaskRegistry
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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::Request