Step

Struct Step 

Source
pub struct Step {
    pub setup: Setup,
    pub ops: Vec<Op>,
    pub hold: HoldSpec,
}
Expand description

A sequence of ops followed by a hold period.

For non-Loop steps, ops are applied first, then setup cgroups are created, configured, and populated. For Loop steps, setup runs once before the ops loop.

Construct via Step::new (ops-only, no setup), Step::with_defs (cgroup setup + hold), or Step::with_payload (payload-driven step). For chained mutation of the ops list, Step::set_ops REPLACES the existing vec — Backdrop’s extend_ops semantics (APPEND) are not mirrored here because Step is single-phase.

Fields§

§setup: Setup

Cgroup setup applied before (non-Loop) or once above (Loop) the ops list. Runtime cgroups are spawned from this spec.

§ops: Vec<Op>

Ordered operations applied each time the step body runs: cpuset edits, task moves, spawn/despawn, etc.

§hold: HoldSpec

How long, and whether to loop, after the ops finish one pass.

Implementations§

Source§

impl Step

Source

pub fn new(ops: Vec<Op>, hold: HoldSpec) -> Self

Create a step with ops only (no CgroupDef setup). Prefer this constructor over the struct-literal Step { setup, ops, hold } form — the constructor preserves struct stability across non_exhaustive field additions (e.g. future Step::with_* builder methods) and is the stable surface tracked by Self::with_defs + Self::hold.

// Common one-liner: spawn workers then hold for 1s.
let s = Step::new(vec![Op::add_cgroup("cg_a"), Op::spawn(...)],
                  HoldSpec::Fixed(Duration::from_secs(1)));
// For setup-only steps (CgroupDef + spawns) use Step::with_defs.
// For wait-only phases (no ops) use Step::hold.
Source

pub fn hold(hold: HoldSpec) -> Self

Create a step that applies NO ops and just holds. Sugar for Step::new(vec![], hold) — the most common shape for “wait for the workload to settle before the next op” phases in A/B test scenarios.

Source

pub fn with_op(op: Op, hold: HoldSpec) -> Self

Create a step that applies a single op then holds. Sugar for Step::new(vec![op], hold) — the most common shape for “swap scheduler / attach scheduler / replace scheduler then hold” phases in A/B test scenarios.

Source

pub fn with_defs(defs: Vec<CgroupDef>, hold: HoldSpec) -> Self

Create a step with CgroupDef setup and a hold period.

Most steps only need cgroup definitions and a hold duration. Use set_ops to chain ops onto the step.

Source

pub fn set_ops(self, ops: Vec<Op>) -> Self

Replace the ops for a step, consuming and returning it.

Named set_ops rather than extend_ops because the semantics are REPLACE, not EXTEND — contrast Backdrop::extend_ops, which appends. A chained Step::new(ops).set_ops(more) drops ops and keeps only more.

Source

pub const fn set_hold(self, hold: HoldSpec) -> Self

Replace the hold spec for a step, consuming and returning it. Sibling of set_ops — both REPLACE a single field. Bare-verb set_ prefix matches set_ops for prefix-consistency within Step; the convention reserves with_X for alternative constructors (see with_defs, with_payload).

Source

pub fn with_payload(payload: &'static Payload, hold: HoldSpec) -> Self

Create a step that spawns a single userspace Payload binary in the background and holds for the given duration before teardown.

Shorthand for Step::new(vec![Op::run_payload(payload, vec![])], hold). The returned step is chainable — add .set_ops(...) to replace the ops vec (note the REPLACE-not-EXTEND semantics), or use Op::wait_payload(name) / Op::kill_payload(name) on later steps to control the spawned child.

Test authors who want the payload placed in a named cgroup should use Op::run_payload_in_cgroup directly; this convenience targets the common “one payload, whole step” shape.

Trait Implementations§

Source§

impl Clone for Step

Source§

fn clone(&self) -> Step

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Step

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Step

Source§

fn default() -> Self

Empty setup, no ops, hold for the full scenario duration (HoldSpec::FULL). Useful as a sentinel in test fixtures that compose Steps via ..Default::default() field overrides.

Auto Trait Implementations§

§

impl Freeze for Step

§

impl RefUnwindSafe for Step

§

impl Send for Step

§

impl Sync for Step

§

impl Unpin for Step

§

impl UnwindSafe for Step

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,