pub struct ProducerCtx<'a> { /* private fields */ }Expand description
Context handed to a producer’s build closure on activation.
Provides:
Self::node_id/Self::core— identity + Core access for sink callbacks that re-enter Core.Self::subscribe_to— subscribe to an upstream Core node; the resultingSubscriptionis auto-tracked undernode_idin the binding’s producer storage and dropped on producer deactivation.
Implementations§
Source§impl<'a> ProducerCtx<'a>
impl<'a> ProducerCtx<'a>
Sourcepub fn new(
node_id: NodeId,
core: &'a Core,
storage: &'a ProducerStorage,
) -> Self
pub fn new( node_id: NodeId, core: &'a Core, storage: &'a ProducerStorage, ) -> Self
Construct a new context for the binding’s invoke_fn dispatch
to call build closures. Internal — bindings call this; user
code receives the constructed ctx via the build closure’s arg.
Sourcepub fn core(&self) -> &Core
pub fn core(&self) -> &Core
The Core dispatcher. Sink closures use this to re-enter Core —
core.emit(self.node_id(), h) to emit a value, etc.
Sourcepub fn subscribe_to(&self, source: NodeId, sink: Sink) -> SubscribeOutcome
pub fn subscribe_to(&self, source: NodeId, sink: Sink) -> SubscribeOutcome
Subscribe sink to upstream source. The Subscription is
auto-tracked under the producer’s node_id; on producer
deactivation, the binding drops the storage entry, which drops
the Subscription, which unsubscribes the sink.
Phase H+ STRICT (D115, 2026-05-10): uses try_subscribe
to attempt the subscription. On partition order violation, the
subscribe is deferred to wave-end via
DeferredProducerOp::Callback — the deferred callback runs
after all partition wave_owners are released (no partitions
held → safe to acquire any partition).
R2.2.7.b (D118, 2026-05-10): if the upstream is
non-resubscribable AND already terminated, try_subscribe
returns Err(SubscribeError::TornDown). /qa F2 (2026-05-10):
the rejection is now surfaced to the caller via
SubscribeOutcome::Dead so the operator can apply its
per-op dead-source semantics — pre-F2 the rejection was
silently swallowed, leaving operators wedged (zip waiting on a
queue that would never fill, concat stuck on a source that
would never advance, etc.). See SubscribeOutcome::Dead for
per-operator guidance.