pub struct TaskExecutor { /* private fields */ }Expand description
Spawns tasks as OS processes and streams their output over a broadcast channel.
Lives on AppState on the main thread; all async work is delegated to
Tokio task handles stored internally.
Implementations§
Source§impl TaskExecutor
impl TaskExecutor
pub fn new() -> Self
Sourcepub fn with_matcher_registry(matcher_registry: Arc<MatcherRegistry>) -> Self
pub fn with_matcher_registry(matcher_registry: Arc<MatcherRegistry>) -> Self
Create a TaskExecutor that uses the given MatcherRegistry snapshot provider. This is used by AppState to ensure spawned tasks use the central ExtensionManager matcher set.
Sourcepub fn subscribe(&self) -> Receiver<TaskEvent>
pub fn subscribe(&self) -> Receiver<TaskEvent>
Subscribe to the live event stream.
Receivers are independent; a slow receiver simply misses old messages once the ring buffer wraps (broadcast semantics).
Sourcepub fn spawn(
&mut self,
task_id: TaskId,
command: String,
cancellation_token: CancellationToken,
marker: String,
log_store: Option<LogStore>,
op_tx: &UnboundedSender<Vec<Operation>>,
)
pub fn spawn( &mut self, task_id: TaskId, command: String, cancellation_token: CancellationToken, marker: String, log_store: Option<LogStore>, op_tx: &UnboundedSender<Vec<Operation>>, )
Start executing command in a background Tokio task.
- Broadcasts
TaskEvent::Startedimmediately. - Streams stdout and stderr as
TaskEvent::ParsedOutputevents, with raw bytes parsed through per-streamTerminalParserinstances. - Runs a
DiagnosticsExtractor(shared between both streams) and sendsOperation::AddIssuefor each matched diagnostic line. - Runs a
MatcherEngine(separate instance per stream) for each set of extension-defined log matchers; emitsOperation::AddIssuefor every completed block and on end-of-stream flush. - Watches
cancellation_token; kills the process if it fires. - Sends
Operation::TaskFinished(or Cancelled) back throughop_txso the main loop can update the registry.
marker is the issue registry marker used for all extracted issues
(typically "task:{queue}:{target}"). The caller is responsible for
clearing stale issues with this marker before calling spawn.
matchers is the set of compiled log matchers contributed by loaded
extensions. Pass an empty Vec when no extensions are active.
If log_store is provided, a dedicated log-writing sub-task subscribes
to the broadcast channel and writes each line to
.oo/cache/tasks/<task_id>.log, then compresses the file on completion.
Sourcepub fn abort(&mut self, task_id: TaskId)
pub fn abort(&mut self, task_id: TaskId)
Abort the async task for task_id, if one is running.
This does not update the registry — the caller is responsible for
calling crate::task_registry::TaskRegistry::cancel before or after this.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TaskExecutor
impl RefUnwindSafe for TaskExecutor
impl Send for TaskExecutor
impl Sync for TaskExecutor
impl Unpin for TaskExecutor
impl UnsafeUnpin for TaskExecutor
impl UnwindSafe for TaskExecutor
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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>
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>
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