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) -> Graph
Sourcepub fn start_at_epoch(self, epoch: u64) -> Graph
pub fn start_at_epoch(self, epoch: u64) -> Graph
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) -> Graph
pub fn barrier_every(self, every: Duration) -> Graph
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>) -> u32
pub fn operator(&mut self, o: Box<dyn Operator>) -> u32
Sourcepub fn operator_with(
&mut self,
f: Box<dyn FnOnce(u32, &[(u32, u32)]) -> Result<Box<dyn Operator>, String> + Send>,
) -> u32
pub fn operator_with( &mut self, f: Box<dyn FnOnce(u32, &[(u32, u32)]) -> Result<Box<dyn Operator>, String> + Send>, ) -> u32
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>) -> u32
Sourcepub fn sink_with(
&mut self,
f: Box<dyn FnOnce(u32) -> Result<Box<dyn Sink>, String> + Send>,
) -> u32
pub fn sink_with( &mut self, f: Box<dyn FnOnce(u32) -> Result<Box<dyn Sink>, String> + Send>, ) -> u32
A sink built at start on its owning worker only (see DeferredSink).
Sourcepub fn chain_sink(
&mut self,
task: u32,
sink: Box<dyn Sink>,
) -> Result<(), Box<dyn Sink>>
pub fn chain_sink( &mut self, task: u32, 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: &[u32],
me: u32,
exchange: Option<WorkerExchange>,
) -> Result<Running, String>
pub fn start_worker( self, events: SyncSender<Event>, of_task: &[u32], me: u32, 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§
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> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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