pub struct StreamingDag { /* private fields */ }Expand description
The complete DAG topology.
Constructed in Ring 2 via DagBuilder or from SQL CREATE MATERIALIZED VIEW
chains. Once built, the topology is immutable and can be executed in Ring 0.
Implementations§
Source§impl StreamingDag
impl StreamingDag
Sourcepub fn add_node(
&mut self,
name: impl Into<String>,
node_type: DagNodeType,
output_schema: SchemaRef,
) -> Result<NodeId, DagError>
pub fn add_node( &mut self, name: impl Into<String>, node_type: DagNodeType, output_schema: SchemaRef, ) -> Result<NodeId, DagError>
Adds a node to the DAG.
§Errors
Returns DagError::DuplicateNode if a node with the same name exists.
Sourcepub fn add_edge(
&mut self,
source: NodeId,
target: NodeId,
) -> Result<EdgeId, DagError>
pub fn add_edge( &mut self, source: NodeId, target: NodeId, ) -> Result<EdgeId, DagError>
Adds an edge between two nodes.
§Errors
Returns DagError::NodeNotFound if either node does not exist.
Returns DagError::CycleDetected if the edge would create a self-loop.
Sourcepub fn finalize(&mut self) -> Result<(), DagError>
pub fn finalize(&mut self) -> Result<(), DagError>
Finalizes the DAG: validates topology, computes execution order, derives channel types, and identifies shared stages.
§Errors
Returns DagError::EmptyDag if the DAG has no nodes.
Returns DagError::CycleDetected if the graph contains cycles.
Returns DagError::DisconnectedNode if a non-source, non-sink node
has no inputs or no outputs.
Returns DagError::FanOutLimitExceeded if any node exceeds the
maximum fan-out limit.
Sourcepub fn validate(&self) -> Result<(), DagError>
pub fn validate(&self) -> Result<(), DagError>
Validates the DAG topology without modifying internal state.
§Errors
Returns errors for cycles, disconnected nodes, or schema mismatches.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the number of nodes in the DAG.
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Returns the number of edges in the DAG.
Sourcepub fn node_id_by_name(&self, name: &str) -> Option<NodeId>
pub fn node_id_by_name(&self, name: &str) -> Option<NodeId>
Returns the NodeId for a given node name.
Sourcepub fn node_name(&self, id: NodeId) -> Option<String>
pub fn node_name(&self, id: NodeId) -> Option<String>
Returns the node name for a given NodeId.
Sourcepub fn outgoing_edge_count(&self, node: NodeId) -> usize
pub fn outgoing_edge_count(&self, node: NodeId) -> usize
Returns the number of outgoing edges from a node.
Sourcepub fn incoming_edge_count(&self, node: NodeId) -> usize
pub fn incoming_edge_count(&self, node: NodeId) -> usize
Returns the number of incoming edges to a node.
Sourcepub fn execution_order(&self) -> &[NodeId]
pub fn execution_order(&self) -> &[NodeId]
Returns nodes in topological execution order (dependencies first).
Returns metadata for shared stages (nodes with fan-out > 1).
Sourcepub fn is_finalized(&self) -> bool
pub fn is_finalized(&self) -> bool
Returns whether the DAG has been finalized.
Source§impl StreamingDag
impl StreamingDag
Sourcepub fn from_mv_registry(
registry: &MvRegistry,
base_table_schemas: &FxHashMap<String, SchemaRef>,
) -> Result<Self, DagError>
pub fn from_mv_registry( registry: &MvRegistry, base_table_schemas: &FxHashMap<String, SchemaRef>, ) -> Result<Self, DagError>
Constructs a DAG from an MvRegistry and base table schemas.
Creates a Source node for each base table and a MaterializedView node
for each MV, then connects them according to the registry’s dependency
graph. The resulting DAG is finalized and ready for execution.
§Arguments
registry- The MV registry with dependency informationbase_table_schemas- Schemas for each base table referenced by MVs
§Errors
Returns DagError::EmptyDag if the registry is empty and has no base tables.
Returns DagError::BaseTableSchemaNotFound if a base table schema is missing.
Trait Implementations§
Source§impl Debug for StreamingDag
impl Debug for StreamingDag
Auto Trait Implementations§
impl Freeze for StreamingDag
impl !RefUnwindSafe for StreamingDag
impl Send for StreamingDag
impl Sync for StreamingDag
impl Unpin for StreamingDag
impl UnsafeUnpin for StreamingDag
impl !UnwindSafe for StreamingDag
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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