Skip to main content

Context

Struct Context 

Source
pub struct Context {
    pub store: HashMap<String, VirtualValue>,
    pub event_bus: Arc<EventBus>,
    pub run_id: String,
    pub execution_order: Vec<String>,
    pub graph_info: GraphInfo,
    pub remote_executor: Option<Arc<dyn RemoteExecutor>>,
    pub data_store: Option<Arc<dyn DataStore>>,
    pub spill_threshold: usize,
}
Expand description

Execution context passed to filters during runtime.

Node outputs are stored as VirtualValues — they may be materialized in memory, cached on disk, or deferred (not yet computed). The executor resolves them on demand when a downstream node needs the data.

Fields§

§store: HashMap<String, VirtualValue>

Node outputs as virtual values (may be lazy).

§event_bus: Arc<EventBus>

Event bus for emitting runtime events.

§run_id: String

Current run ID.

§execution_order: Vec<String>

Track execution order.

§graph_info: GraphInfo

Graph topology for input resolution.

§remote_executor: Option<Arc<dyn RemoteExecutor>>

Optional remote executor for distributed plans.

§data_store: Option<Arc<dyn DataStore>>

Optional data store for persisting intermediate results.

§spill_threshold: usize

Minimum value size (bytes) to spill to DataStore instead of keeping in memory. Default: 0 (disabled — all values stay in memory).

Implementations§

Source§

impl Context

Source

pub fn new(event_bus: Arc<EventBus>, run_id: impl Into<String>) -> Self

Source

pub fn with_graph_info(self, info: GraphInfo) -> Self

Source

pub fn with_remote_executor(self, executor: Arc<dyn RemoteExecutor>) -> Self

Source

pub fn with_data_store(self, store: Arc<dyn DataStore>) -> Self

Source

pub fn with_spill_threshold(self, bytes: usize) -> Self

Set spill threshold: values larger than this (in bytes) are offloaded to the DataStore and replaced with a VirtualValue::Cached reference. Requires a DataStore to be set via with_data_store().

Source

pub fn get(&self, node_id: &str) -> Option<&Value>

Get the materialized Value for a node, if present and materialized.

Source

pub fn get_virtual(&self, node_id: &str) -> Option<&VirtualValue>

Get the raw VirtualValue for a node.

Source

pub fn set(&mut self, node_id: impl Into<String>, value: Value)

Store a materialized value for a node.

Source

pub fn set_virtual(&mut self, node_id: impl Into<String>, vv: VirtualValue)

Store a virtual value (which may be deferred or cached).

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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