Skip to main content

ParsedOp

Struct ParsedOp 

Source
pub struct ParsedOp {
Show 19 fields pub name: String, pub description: Option<String>, pub op: HashMap<String, Value>, pub bindings: BindingsDef, pub params: HashMap<String, Value>, pub tags: HashMap<String, String>, pub condition: Option<String>, pub delay: Option<DelaySpec>, pub metrics: HashMap<String, MetricSpec>, pub result: Option<ResultSpec>, pub traverse: Option<TraverseSpec>, pub wrappers: Option<WrappersConfig>, pub captures: Vec<CapturePoint>, pub abstract_interface: Option<OpInterface>, pub interface_bound: bool, pub daemon: DaemonSpec, pub daemon_cancel_grace_ms: Option<u64>, pub while_cond: Option<String>, pub rate: Option<String>,
}
Expand description

A normalized op template — the canonical form.

Fields§

§name: String§description: Option<String>§op: HashMap<String, Value>

The operation payload: field name → value. The statement is always under "stmt" after normalization. The original field name that carried the statement (e.g., "raw", "simple", "prepared", "stmt") is preserved in stmt_type for adapters that dispatch on execution mode.

§bindings: BindingsDef

Binding definitions: either a name→expression map (legacy) or a Polydat grammar source string (native).

§params: HashMap<String, Value>

Configuration parameters.

§tags: HashMap<String, String>

Tags for filtering and metadata.

§condition: Option<String>

Optional condition expression (from YAML if: field). Evaluated per cycle before the op executes. If the result is falsy (false, 0, empty string, None), the op is skipped.

§delay: Option<DelaySpec>

Optional delay specification (from YAML delay: field). Two surface forms:

  • Bare string: delay: <name> — a Polydat binding name producing the pre-op delay value (u64 = ns, f64 = ms).
  • Map: delay: { before: <name>, after: <name> } — independent pre-op and post-op delays; both subkeys are optional but at least one must be set.
§metrics: HashMap<String, MetricSpec>

SRD-40b synthetic-metric declarations. Each entry publishes one metric family per cycle, valued by a GK expression evaluated in the op’s bound scope. Empty when absent. Map key is the metric name and the default family name; MetricSpec::family overrides it when set. See SRD-40b §1 for the schema, §2 for sugared forms (bare-string / list with wire-expression entries).

§result: Option<ResultSpec>

SRD-66 result-bindings. Vari-structured: string is Polydat source, list is a sequence of fragments, map is named-key short-forms with a composite-map output. None ⇒ no result wires; the result wrapper is a no-op for this op.

§traverse: Option<TraverseSpec>

Optional traverse: block — CUSTOMISES the always-installed result traversal layer; it does not select it. Like result:, absence means “default behaviour”, not “no traversal”.

§wrappers: Option<WrappersConfig>

SRD-32a Push 3 — per-op wrapper-composition override. When present, this op uses the named order instead of the workload-root or runtime-default tiebreaker order. Shadows the workload-root wrappers: block entirely (no merge).

§captures: Vec<CapturePoint>

Capture-point specs extracted at parse time from any string-valued entry in op. Each spec names a column the result body carries and the wire it should be written to via ctx.wires.write at cycle time. The slurp flag selects between single-row ([name]) and all-rows ([@name]) extraction.

The parser strips the bracket syntax from the source op fields after harvesting the spec, so adapters consume clean text (e.g. SELECT [key] FROM ... becomes SELECT key FROM ...). Downstream wrappers read this list directly — no re-parsing of the op’s text fields.

§abstract_interface: Option<OpInterface>

SRD-108 Part B — present when this op was declared as an ABSTRACT slot (abstract: body): the interface a bound implementation must satisfy. Retained on the bound op so pre-map synthesis can verify yields against the compiled op-template program.

§interface_bound: bool

SRD-108 Part B — true once an implementation has been bound into this slot. An op with an interface but interface_bound == false at run initiation is a load error (“abstract op unbound”).

§daemon: DaemonSpec

Daemon-fiber declaration. When set to a non-Disabled value, dispatches of this op from the cycle-pool spawn onto a daemon fiber instead of running inline. Daemons stay in scope of the phase so their failures bubble up; the cycle-pool fiber continues immediately to the next op without awaiting.

YAML forms accepted:

  • daemon: false / daemon: 0 / daemon: "off" → not a daemon (cycle-pool op).
  • daemon: true / daemon: 1 / daemon: "on" → daemon, max 1 concurrent fiber per phase activation.
  • daemon: <N> (N ≥ 1) → daemon, max N concurrent fibers per phase activation.

The cap is enforced at spawn time: when the cycle-pool dispatches the op and the live-fiber count is already at N, the spawn errors and the phase fails with a clear stop_reason. There’s no queuing — exceeding the cap is a workload-design error, not backpressure to absorb.

Per-op-name dedup: daemons are tracked by op-template name. Subsequent dispatches of the same name silently succeed up to the cap; over the cap they fail loud. Natural daemon exit (Completed / Cancelled / Errored / TimedOut / Panicked) decrements the count, freeing a slot for the next dispatch.

Use case: a long-running server call (e.g. forceKeyspaceCompaction) that the workload wants to fire while a sibling op concurrently observes progress. The daemon op stays in scope so its failures bubble up; the cycle-pool op runs alongside without serialisation.

Parser invariants when daemon is MaxFibers(_):

  • cycles: and ratio: on this op are rejected — the daemon’s dispatch cadence is governed by the cycle-pool walks, not by cycles-per-second.
  • if: / while: apply as usual; a falsy guard skips the dispatch with no spawn.
§daemon_cancel_grace_ms: Option<u64>

How long the phase waits for this daemon’s in-flight future to drop after sending the stop signal. Past the window, the phase records a daemon-shutdown failure and fails. Per-op override of the activity-level default (5000 ms).

Only meaningful when daemon is MaxFibers(_).

§while_cond: Option<String>

Polydat boolean expression evaluated on the daemon’s fiber inside the wrapper stack. When set, the daemon body runs a loop: while the condition is truthy, dispatch the inner op; when falsy or stop-signalled, exit.

while: composes inside if: (which gates whether the loop starts at all) and outside the per-op-rate throttling (which paces iterations).

Parser invariants:

  • while: on a non-daemon op is currently allowed but blocks the cycle-pool fiber until the loop exits. The common use case is daemon + while.
§rate: Option<String>

Per-op rate spec governing the iteration cadence of the while-loop (or per-cycle dispatch for non-loop ops). Format: "<N>" (N/s, bare integer), "<N>/s", "<N>/m", "<N>/h". Each op with rate: gets its own RateLimiter at phase init — INDEPENDENT of the activity-level rate: and of other ops’ rate limiters.

rate: 0 is “unlimited” (no throttling).

Implementations§

Source§

impl ParsedOp

Source

pub fn simple(name: &str, stmt: &str) -> Self

Create a minimal ParsedOp with just a name and stmt.

Trait Implementations§

Source§

impl Clone for ParsedOp

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ParsedOp

Source§

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

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

impl<'de> Deserialize<'de> for ParsedOp

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl HasPolydatMatter for ParsedOp

Source§

fn polydat_matter(&self) -> PolydatMatter

Classify this node’s contribution to Polydat content.
Source§

impl Serialize for ParsedOp

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.