pub struct Discovery { /* private fields */ }Expand description
The master’s view of DAG discovery.
Implementations§
Source§impl Discovery
impl Discovery
Sourcepub fn set_metrics(&mut self, metrics: MasterMetrics)
pub fn set_metrics(&mut self, metrics: MasterMetrics)
Counts parse jobs in metrics.
Sourcepub fn set_wakes(&mut self, wakes: Wakes)
pub fn set_wakes(&mut self, wakes: Wakes)
Wakes the DAGs it defines anew (a new version, or back) through wakes.
Sourcepub fn set_notifications(&mut self, notifications: Arc<Notifications>)
pub fn set_notifications(&mut self, notifications: Arc<Notifications>)
Checks DAGs’ notify= against notifications.
Sourcepub const fn with_max_message_size(self, bytes: usize) -> Self
pub const fn with_max_message_size(self, bytes: usize) -> Self
Discovery refusing tasks whose output can’t fit bytes, the master’s message limit.
Sourcepub fn new(db: Database, master: SchedrVersion, jobs: ParseJobs) -> Self
pub fn new(db: Database, master: SchedrVersion, jobs: ParseJobs) -> Self
Discovery over a database, checking DAG JSON for a master of version master.
Sourcepub fn memory(&self) -> Memory
pub fn memory(&self) -> Memory
A copy of what discovery keeps in memory, for Self::restore.
Sourcepub fn restore(&mut self, memory: Memory)
pub fn restore(&mut self, memory: Memory)
Puts back a copy taken by Self::memory: the work since was rolled back.
Sourcepub fn stop_parsing(
&mut self,
worker_id: &str,
now: Timestamp,
) -> Vec<ParseAssignment>
pub fn stop_parsing( &mut self, worker_id: &str, now: Timestamp, ) -> Vec<ParseAssignment>
A worker drains (or is drained): it gets no parse jobs, and its unfinished ones go to other workers that reported the same hash. Returns those assignments.
Sourcepub fn release_jobs(&mut self, worker_id: &str) -> Vec<ParseKey>
pub fn release_jobs(&mut self, worker_id: &str) -> Vec<ParseKey>
A worker registers anew: its parse jobs are released (ParseJobs::release).
Sourcepub fn hand_out(
&mut self,
keys: &[ParseKey],
now: Timestamp,
) -> Vec<ParseAssignment>
pub fn hand_out( &mut self, keys: &[ParseKey], now: Timestamp, ) -> Vec<ParseAssignment>
The released jobs its registration didn’t take back (ParseJobs::hand_out).
Sourcepub async fn allow_parsing(
&mut self,
worker_id: &str,
now: Timestamp,
) -> Result<Vec<ParseAssignment>, DbError>
pub async fn allow_parsing( &mut self, worker_id: &str, now: Timestamp, ) -> Result<Vec<ParseAssignment>, DbError>
Sourcepub fn current_code(
&self,
) -> impl Iterator<Item = (&str, &str, &BTreeSet<String>, Option<SchedrVersion>)>
pub fn current_code( &self, ) -> impl Iterator<Item = (&str, &str, &BTreeSet<String>, Option<SchedrVersion>)>
Each root’s current content hash, the hashes whose workers may run its tasks (the current one and newer ones whose parse is on its way), and the schedr version of the current parse (workers older than that don’t get its tasks).
Sourcepub const fn jobs_mut(&mut self) -> &mut ParseJobs
pub const fn jobs_mut(&mut self) -> &mut ParseJobs
The parse jobs, to hand out again when a worker is lost or a job times out.
Sourcepub async fn registered(
&mut self,
worker_id: &str,
keys: Vec<ParseKey>,
now: Timestamp,
) -> Result<Vec<ParseAssignment>, DbError>
pub async fn registered( &mut self, worker_id: &str, keys: Vec<ParseKey>, now: Timestamp, ) -> Result<Vec<ParseAssignment>, DbError>
Sourcepub async fn root_withdrawn(
&mut self,
worker_id: &str,
root: &str,
now: Timestamp,
) -> Result<(), DbError>
pub async fn root_withdrawn( &mut self, worker_id: &str, root: &str, now: Timestamp, ) -> Result<(), DbError>
Sourcepub async fn root_reported(
&mut self,
worker_id: &str,
key: ParseKey,
now: Timestamp,
) -> Result<Option<ParseAssignment>, DbError>
pub async fn root_reported( &mut self, worker_id: &str, key: ParseKey, now: Timestamp, ) -> Result<Option<ParseAssignment>, DbError>
Sourcepub async fn worker_gone(
&mut self,
worker_id: &str,
now: Timestamp,
) -> Result<(), DbError>
pub async fn worker_gone( &mut self, worker_id: &str, now: Timestamp, ) -> Result<(), DbError>
Sourcepub async fn parse_uploaded(
&mut self,
upload: ParseUpload,
now: Timestamp,
) -> Result<String, DbError>
pub async fn parse_uploaded( &mut self, upload: ParseUpload, now: Timestamp, ) -> Result<String, DbError>
Stores an uploaded parse (after validation) and finishes its job. If it is the parse of the root’s reported hash, it becomes current and the DAG list is updated. Returns the stored parse’s ID.
When key has a stored parse, the upload is a retry (decision 72.2): it replaces
only the stored files that failed transiently, so a file that loaded once keeps its
result. Files that (still) failed transiently get another retry, after a delay.
§Errors
DbError if storing fails.
Sourcepub const fn registries(&self) -> &BTreeMap<String, Arc<Registry>>
pub const fn registries(&self) -> &BTreeMap<String, Arc<Registry>>
Each root’s connections from its current parse, as Registry JSON (decision 174).
Sourcepub const fn script_uses(&self) -> &ScriptUses
pub const fn script_uses(&self) -> &ScriptUses
The script roots each DAG root’s current parse asked about (decision 304).
Sourcepub fn reported_script_roots(&self) -> BTreeSet<String>
pub fn reported_script_roots(&self) -> BTreeSet<String>
The script roots alive workers report now.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Discovery
impl !UnwindSafe for Discovery
impl Freeze for Discovery
impl Send for Discovery
impl Sync for Discovery
impl Unpin for Discovery
impl UnsafeUnpin for Discovery
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
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>,
Layered].§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);