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) -> Graph

Source

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.

Source

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

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>) -> u32

Source

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

Source

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.

Source

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

Source

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).

Source

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

Route from’s output.

Source

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.

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: &[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§

Source§

impl Default for Graph

Source§

fn default() -> Graph

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Pointer = u32

Source§

fn debug( pointer: <T as Pointee>::Pointer, f: &mut Formatter<'_>, ) -> Result<(), Error>

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool