#[non_exhaustive]pub struct PhaseSpec<'a> {
pub name: &'a str,
pub weight: u64,
pub total: Total,
pub units: &'a str,
pub execution: Execution,
}Expand description
One child in a split: a name, a weight relative to its siblings, a total, and optionally a unit name and an execution model.
Weights are relative, so [35, 30, 35] gives the middle child exactly 30%
of its parent however many workers it later uses. Build it with
PhaseSpec::new; the fields stay readable, and new planning options can
be added without breaking existing code.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: &'a strHuman-readable phase name.
weight: u64Positive weight relative to the siblings.
total: TotalDenominator for this phase’s completed units.
units: &'a strName of the counted unit, such as rows or superblocks.
execution: ExecutionHow this phase’s work is scheduled.
Implementations§
Source§impl<'a> PhaseSpec<'a>
impl<'a> PhaseSpec<'a>
Sourcepub const fn new(name: &'a str, weight: u64, total: Total) -> Self
pub const fn new(name: &'a str, weight: u64, total: Total) -> Self
Describe one weighted child that counts items.
Sourcepub const fn execution(self, execution: Execution) -> Self
pub const fn execution(self, execution: Execution) -> Self
Declare how this phase’s work is scheduled.
Sourcepub fn validate_split(parts: &[PhaseSpec<'_>]) -> Result<u64, PlanError>
pub fn validate_split(parts: &[PhaseSpec<'_>]) -> Result<u64, PlanError>
Check a split’s parts the way every Pulse::split must, and return
the sum of their weights.
Fails with PlanError::EmptyOrZeroWeight for no parts or a zero
weight, and PlanError::Overflow if the weights’ sum overflows. Call
it first in a split implementation, so every pulse rejects the same
plans with the same errors.