pub struct ResultDispenser { /* private fields */ }Expand description
Wraps an inner OpDispenser to expose declared op-result fields as Polydat named wires (SRD-40b §5).
Per cycle, after the inner adapter returns its OpResult, this
wrapper walks the op template’s result: HashMap<String, ResultWireSpec> declarations, computes each value from the
result body, and writes it through ctx.wires.write(name, value)
onto the per-fiber op-template kernel’s input slot. Wrappers
later in the stack (e.g. MetricsDispenser) read freshly through
ctx.wires.get(name), so SRD-40b §5.2 metric evaluation sees
the values landed this cycle — no HashMap intermediary.
Insertion order in the wrapper stack (SRD-40b §5.2): inner adapter → ResultDispenser → MetricsDispenser (Phase E).
Source grammars (SRD-40b §5.1):
count— built-in;OpResult::body.element_count().ok— built-in;trueiff the inner adapter returnedOk(_)(errors short-circuit before this wrapper’s body runs, so reaching this code already implies success —okistrueunless the result was a skip).<path-expr>— JSON-pointer-style lookup into the result body. Supports bare names (field), dotted paths (rows.0.field), and bracketed indices (rows[0].field).<polydat-call>— DEFERRED. Recognized as anything containing a(token; currently logged once and skipped. Phase E or a follow-up adds the GK-eval-against-result-context path.
Implementations§
Source§impl ResultDispenser
impl ResultDispenser
Sourcepub fn wrap(
inner: Arc<dyn OpDispenser>,
result_spec: Option<&ResultSpec>,
interface_results: Option<&BTreeMap<String, String>>,
) -> Arc<dyn OpDispenser> ⓘ
pub fn wrap( inner: Arc<dyn OpDispenser>, result_spec: Option<&ResultSpec>, interface_results: Option<&BTreeMap<String, String>>, ) -> Arc<dyn OpDispenser> ⓘ
Wrap an inner dispenser with result-as-GK exposure (SRD-40b §5.2’s result-as-GK adapter layer).
Always wraps. Per the SRD, this layer is part of the
canonical per-cycle pipeline: it writes the magic externs
(body / count / ok) into the op-template kernel’s
input slots after the inner adapter returns, so any
downstream wrapper (metrics, validation, conditional next
op) reading those names through ctx.wires.get sees fresh
values. Writes to slots the kernel didn’t allocate (the
closure-binding economy’s DCE) silently no-op via
WriteOutcome::NoSlot — no overhead for ops whose
op-template kernel doesn’t reference any magic extern.
The optional result_spec adds additional dispenser-side
dispatch slots (legacy SRD-40b §5.1 path-expr / count /
ok map-shape forms). Kernel-driven entries (string-shape
source blocks, polydat-call entries) need no per-cycle code
here — add_result_bindings compiled them into the
op-template kernel; the magic-extern population this
wrapper always performs is what makes them resolve.
Trait Implementations§
Source§impl OpDispenser for ResultDispenser
impl OpDispenser for ResultDispenser
Source§fn execute<'a>(
&'a self,
cycle: u64,
ctx: &'a ExecCtx<'a>,
) -> Pin<Box<dyn Future<Output = Result<OpResult, ExecutionError>> + Send + 'a>>
fn execute<'a>( &'a self, cycle: u64, ctx: &'a ExecCtx<'a>, ) -> Pin<Box<dyn Future<Output = Result<OpResult, ExecutionError>> + Send + 'a>>
Source§fn inner_dispenser(&self) -> Option<&dyn OpDispenser>
fn inner_dispenser(&self) -> Option<&dyn OpDispenser>
None when this is a leaf (the adapter’s
base dispenser — e.g. CQL raw / prepared / batch,
HTTP, stdout, plotter, …). Read moreSource§fn describe(&self) -> Option<String>
fn describe(&self) -> Option<String>
{table}, {key}, ?, …). Read moreSource§fn describe_resolved(&self, wires: &dyn WireSource) -> Option<String>
fn describe_resolved(&self, wires: &dyn WireSource) -> Option<String>
Source§fn canonical_kernel(&self) -> Option<&Arc<dyn Kernel>>
fn canonical_kernel(&self) -> Option<&Arc<dyn Kernel>>
map_op from its parent — the
parent itself, or a kernel bound under it. Any engine: the
executor finds the program to bind per fiber by program_id.
Returns None for dispensers that don’t own a kernel
(adapters with no Polydat needs, or wrappers that delegate to
an inner dispenser). Read moreSource§fn adapter_metrics(&self) -> Vec<(String, Labels, MetricValue)>
fn adapter_metrics(&self) -> Vec<(String, Labels, MetricValue)>
Source§fn status_counters(&self) -> Vec<(&str, u64)>
fn status_counters(&self) -> Vec<(&str, u64)>
Source§fn rows_per_op(&self) -> usize
fn rows_per_op(&self) -> usize
execute call reads and covers. Read moreimpl WrappingDispenser for ResultDispenser
Auto Trait Implementations§
impl !RefUnwindSafe for ResultDispenser
impl !UnwindSafe for ResultDispenser
impl Freeze for ResultDispenser
impl Send for ResultDispenser
impl Sync for ResultDispenser
impl Unpin for ResultDispenser
impl UnsafeUnpin for ResultDispenser
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
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