pub struct Conductor { /* private fields */ }Expand description
The conductor’s state across polling cycles: its own CLI-side conversation and the last (revision, stalled ∪ finished ids) pair it actually acted on.
Implementations§
Source§impl Conductor
impl Conductor
Sourcepub fn worth_a_look(
&self,
queue: &Queue,
stalled: &[Task],
finished: &[Task],
) -> bool
pub fn worth_a_look( &self, queue: &Queue, stalled: &[Task], finished: &[Task], ) -> bool
Whether calling the conductor could possibly do anything different
from last time: Queue::revision moved, or the set of stalled and
finished task ids changed.
Deliberately not “stalled or finished is non-empty” - a task sitting stalled or finished with nobody changing anything about it must not be re-shown to the model every single poll forever; only a change in which tasks are stalled or finished, or a queue write changing something about a runnable one, is worth another look.
Cheap and config-free on purpose, so crate::daemon’s poll loop can
skip Config::discover’s synchronous I/O entirely on a cycle where
this says no - which Conductor::maybe_run would otherwise only
discover after paying for that load. Both ask the identical question,
from the same Conductor::last_seen, so they can never disagree
about whether there is anything to look at.
Sourcepub async fn maybe_run(
&mut self,
cfg: &Config,
repo: &Path,
queue: &Queue,
questions: &Questions,
home: &Path,
queued: &[Task],
stalled: &[Task],
finished: &[Task],
max_attempts: usize,
)
pub async fn maybe_run( &mut self, cfg: &Config, repo: &Path, queue: &Queue, questions: &Questions, home: &Path, queued: &[Task], stalled: &[Task], finished: &[Task], max_attempts: usize, )
Call the conductor once, unless nothing has changed since the last
time it was worth calling - see Conductor::worth_a_look, the exact
same test. Never fatal - see this module’s doc.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Conductor
impl RefUnwindSafe for Conductor
impl Send for Conductor
impl Sync for Conductor
impl Unpin for Conductor
impl UnsafeUnpin for Conductor
impl UnwindSafe for Conductor
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> 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> ⓘ
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