pub struct Graph { /* private fields */ }Expand description
The graph under construction: add tasks, connect routes, then start.
Implementations§
Source§impl Graph
impl Graph
pub fn new(edge_capacity: usize) -> Self
Sourcepub fn start_at_epoch(self, epoch: u64) -> Self
pub fn start_at_epoch(self, epoch: u64) -> Self
Continue the epoch numbering from epoch: the first epoch issued is epoch + 1. A run
restored from a checkpoint passes that checkpoint’s epoch, so its own checkpoints always
read as newer than the one it restored from.
Sourcepub fn barrier_every(self, every: Duration) -> Self
pub fn barrier_every(self, every: Duration) -> Self
Issue an epoch (a barrier to every source) this often. Without it, only stop issues one.
pub fn source(&mut self, s: Box<dyn Source>) -> TaskId
pub fn operator(&mut self, o: Box<dyn Operator>) -> TaskId
Sourcepub fn operator_with(&mut self, f: DeferredOperator) -> TaskId
pub fn operator_with(&mut self, f: DeferredOperator) -> TaskId
An operator that needs to know its input edges (a join’s sides): built at start.
pub fn sink(&mut self, s: Box<dyn Sink>) -> TaskId
Sourcepub fn sink_with(&mut self, f: DeferredSink) -> TaskId
pub fn sink_with(&mut self, f: DeferredSink) -> TaskId
A sink built at start on its owning worker only (see DeferredSink).
Sourcepub fn chain_sink(
&mut self,
task: TaskId,
sink: Box<dyn Sink>,
) -> Result<(), Box<dyn Sink>>
pub fn chain_sink( &mut self, task: TaskId, sink: Box<dyn Sink>, ) -> Result<(), Box<dyn Sink>>
Chain sink into source task task (see Chained); hands the sink back when the task
is not a source.
Sourcepub fn start(self, events: SyncSender<Event>) -> Result<Running, String>
pub fn start(self, events: SyncSender<Event>) -> Result<Running, String>
Spawn every task on this single-process worker; returns the running dataflow. Every edge is
a local SyncSender. For one worker of a multi-process run, see Graph::start_worker.
Sourcepub fn start_worker(
self,
events: SyncSender<Event>,
of_task: &[WorkerId],
me: WorkerId,
exchange: Option<WorkerExchange>,
) -> Result<Running, String>
pub fn start_worker( self, events: SyncSender<Event>, of_task: &[WorkerId], me: WorkerId, exchange: Option<WorkerExchange>, ) -> Result<Running, String>
Spawn only the tasks this worker owns and wire the graph’s edges according to the placement
of_task (task id → worker id): an edge between two co-located tasks is a local SyncSender;
an edge from a local task to a task on another worker is drained by an OutboundBridge onto
the link to that worker; an edge into a local task from a remote one arrives via an
InboundBridge on the peer’s link and is delivered to the local dest inbox. A task on no
other worker is not run here. Every worker builds the identical graph in the identical
order, so edge ids agree across workers and the edge on the wire names the same logical
edge — hence the same dest task — on every worker. A solo placement (every task on me, no
exchange) is exactly Graph::start.