Skip to main content

Graph

Struct Graph 

Source
pub struct Graph { /* private fields */ }
Expand description

The graph under construction: add tasks, connect routes, then start.

Implementations§

Source§

impl Graph

Source

pub fn new(edge_capacity: usize) -> Self

Source

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.

Source

pub fn barrier_every(self, every: Duration) -> Self

Issue an epoch (a barrier to every source) this often. Without it, only stop issues one.

Source

pub fn source(&mut self, s: Box<dyn Source>) -> TaskId

Source

pub fn operator(&mut self, o: Box<dyn Operator>) -> TaskId

Source

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.

Source

pub fn sink(&mut self, s: Box<dyn Sink>) -> TaskId

Source

pub fn sink_with(&mut self, f: DeferredSink) -> TaskId

A sink built at start on its owning worker only (see DeferredSink).

Source

pub fn route(&mut self, from: TaskId, route: Route)

Route from’s output.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Default for Graph

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Graph

§

impl !Sync for Graph

§

impl !UnwindSafe for Graph

§

impl Freeze for Graph

§

impl Send for Graph

§

impl Unpin for Graph

§

impl UnsafeUnpin for Graph

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.