pub struct Scope<'scope, T: Timestamp> { /* private fields */ }Expand description
A Scope manages the creation of new dataflow scopes, of operators and edges between them.
This is a shared object that can be freely copied, subject to its lifetime requirements.
It manages scope construction through a RefCell-wrapped subgraph builder, and all of
this type’s methods use but do not hold write access through the RefCell.
Implementations§
Source§impl<'scope, T: Timestamp> Scope<'scope, T>
impl<'scope, T: Timestamp> Scope<'scope, T>
Sourcepub fn activations(&self) -> Rc<RefCell<Activations>>
pub fn activations(&self) -> Rc<RefCell<Activations>>
Provides a shared handle to the activation scheduler.
Sourcepub fn activator_for(&self, path: Rc<[usize]>) -> Activator
pub fn activator_for(&self, path: Rc<[usize]>) -> Activator
Constructs an Activator tied to the specified operator address.
Sourcepub fn addr(&self) -> Rc<[usize]>
pub fn addr(&self) -> Rc<[usize]>
A sequence of scope identifiers describing the path from the worker root to this scope.
Sourcepub fn add_edge(&self, source: Source, target: Target)
pub fn add_edge(&self, source: Source, target: Target)
Connects a source of data with a target of the data. This only links the two for the purposes of tracking progress, rather than effect any data movement itself.
Sourcepub fn reserve_operator(&self) -> OperatorSlot<'scope, T>
pub fn reserve_operator(&self) -> OperatorSlot<'scope, T>
Reserves a slot for an operator in this scope.
The returned OperatorSlot carries the scope-local index and worker-unique
identifier of the future operator. It must be consumed by OperatorSlot::install
before being dropped; otherwise it will panic, since the scope expects every
reserved slot to eventually be filled.
Sourcepub fn scoped<T2, R, F>(&self, name: &str, func: F) -> R
pub fn scoped<T2, R, F>(&self, name: &str, func: F) -> R
Creates a dataflow subgraph.
This method allows the user to create a nested scope with any timestamp that “refines” the enclosing timestamp (informally: extends it in a reversible way).
This is most commonly used to create new iterative contexts, and the provided
method iterative for this task demonstrates the use of this method.
§Examples
use timely::dataflow::operators::{Input, Enter, Leave};
use timely::order::Product;
timely::execute_from_args(std::env::args(), |worker| {
// must specify types as nothing else drives inference.
let input = worker.dataflow::<u64,_,_>(|child1| {
let (input, stream) = child1.new_input::<Vec<String>>();
let output = child1.scoped::<Product<u64,u32>,_,_>("ScopeName", |child2| {
stream.enter(child2).leave(child1)
});
input
});
});Sourcepub fn scoped_raw<T2, R, F>(
&self,
name: &str,
func: F,
) -> (R, Subgraph<T, T2>, OperatorSlot<'scope, T>)
pub fn scoped_raw<T2, R, F>( &self, name: &str, func: F, ) -> (R, Subgraph<T, T2>, OperatorSlot<'scope, T>)
Creates a dataflow subgraph, runs a user closure, and returns a result and the to-be-assembled parts.
The returned subgraph must be registered in the operator slot.
Sourcepub fn iterative<T2, R, F>(&self, func: F) -> R
pub fn iterative<T2, R, F>(&self, func: F) -> R
Creates an iterative dataflow subgraph.
This method is a specialization of scoped which uses the Product timestamp
combinator, suitable for iterative computations in which iterative development
at some time cannot influence prior iterations at a future time.
§Examples
use timely::dataflow::operators::{Input, Enter, Leave};
timely::execute_from_args(std::env::args(), |worker| {
// must specify types as nothing else drives inference.
let input = worker.dataflow::<u64,_,_>(|child1| {
let (input, stream) = child1.new_input::<Vec<String>>();
let output = child1.iterative::<u32,_,_>(|child2| {
stream.enter(child2).leave(child1)
});
input
});
});Sourcepub fn region<R, F>(&self, func: F) -> R
pub fn region<R, F>(&self, func: F) -> R
Creates a dataflow region with the same timestamp.
This method is a specialization of scoped which uses the same timestamp as the
containing scope. It is used mainly to group regions of a dataflow computation, and
provides some computational benefits by abstracting the specifics of the region.
§Examples
use timely::dataflow::operators::{Input, Enter, Leave};
timely::execute_from_args(std::env::args(), |worker| {
// must specify types as nothing else drives inference.
let input = worker.dataflow::<u64,_,_>(|child1| {
let (input, stream) = child1.new_input::<Vec<String>>();
let output = child1.region(|child2| {
stream.enter(child2).leave(child1)
});
input
});
});Sourcepub fn region_named<R, F>(&self, name: &str, func: F) -> R
pub fn region_named<R, F>(&self, name: &str, func: F) -> R
Creates a dataflow region with the same timestamp and a supplied name.
This method is a specialization of scoped which uses the same timestamp as the
containing scope. It is used mainly to group regions of a dataflow computation, and
provides some computational benefits by abstracting the specifics of the region.
This variant allows you to specify a name for the region, which can be read out in the timely logging streams.
§Examples
use timely::dataflow::operators::{Input, Enter, Leave};
timely::execute_from_args(std::env::args(), |worker| {
// must specify types as nothing else drives inference.
let input = worker.dataflow::<u64,_,_>(|child1| {
let (input, stream) = child1.new_input::<Vec<String>>();
let output = child1.region_named("region", |child2| {
stream.enter(child2).leave(child1)
});
input
});
});Trait Implementations§
Source§impl<'scope, T: Timestamp> Concatenate<'scope, T> for Scope<'scope, T>
impl<'scope, T: Timestamp> Concatenate<'scope, T> for Scope<'scope, T>
Source§fn concatenate<I, C: Container>(&self, sources: I) -> Stream<'scope, T, C>where
I: IntoIterator<Item = Stream<'scope, T, C>>,
fn concatenate<I, C: Container>(&self, sources: I) -> Stream<'scope, T, C>where
I: IntoIterator<Item = Stream<'scope, T, C>>,
Source§impl<'scope, T: Timestamp + TotalOrder> Input<'scope> for Scope<'scope, T>
impl<'scope, T: Timestamp + TotalOrder> Input<'scope> for Scope<'scope, T>
Source§fn new_input<C: Container + Clone>(
&self,
) -> (Handle<T, CapacityContainerBuilder<C>>, Stream<'scope, T, C>)
fn new_input<C: Container + Clone>( &self, ) -> (Handle<T, CapacityContainerBuilder<C>>, Stream<'scope, T, C>)
Source§fn new_input_with_builder<CB: ContainerBuilder<Container: Clone>>(
&self,
) -> (Handle<T, CB>, Stream<'scope, T, CB::Container>)
fn new_input_with_builder<CB: ContainerBuilder<Container: Clone>>( &self, ) -> (Handle<T, CB>, Stream<'scope, T, CB::Container>)
Source§fn input_from<CB: ContainerBuilder<Container: Clone>>(
&self,
handle: &mut Handle<T, CB>,
) -> Stream<'scope, T, CB::Container>
fn input_from<CB: ContainerBuilder<Container: Clone>>( &self, handle: &mut Handle<T, CB>, ) -> Stream<'scope, T, CB::Container>
Source§impl<'scope, T: Timestamp + TotalOrder> Input<'scope> for Scope<'scope, T>
impl<'scope, T: Timestamp + TotalOrder> Input<'scope> for Scope<'scope, T>
Source§impl<'scope, T: Timestamp> UnorderedInput<'scope, T> for Scope<'scope, T>
impl<'scope, T: Timestamp> UnorderedInput<'scope, T> for Scope<'scope, T>
Source§fn new_unordered_input<CB: ContainerBuilder>(
&self,
) -> ((UnorderedHandle<T, CB>, ActivateCapability<T>), Stream<'scope, T, CB::Container>)
fn new_unordered_input<CB: ContainerBuilder>( &self, ) -> ((UnorderedHandle<T, CB>, ActivateCapability<T>), Stream<'scope, T, CB::Container>)
Source§impl<'scope, T: Timestamp> UnorderedInput<'scope, T> for Scope<'scope, T>
impl<'scope, T: Timestamp> UnorderedInput<'scope, T> for Scope<'scope, T>
Source§fn new_unordered_input<D: 'static>(
&self,
) -> ((UnorderedHandle<T, D>, ActivateCapability<T>), StreamVec<'scope, T, D>)
fn new_unordered_input<D: 'static>( &self, ) -> ((UnorderedHandle<T, D>, ActivateCapability<T>), StreamVec<'scope, T, D>)
StreamVec and Handle through which to supply input. This
input supports multiple open epochs (timestamps) at the same time. Read moreimpl<'scope, T: Timestamp> Copy for Scope<'scope, T>
Auto Trait Implementations§
impl<'scope, T> Freeze for Scope<'scope, T>
impl<'scope, T> !RefUnwindSafe for Scope<'scope, T>
impl<'scope, T> !Send for Scope<'scope, T>
impl<'scope, T> !Sync for Scope<'scope, T>
impl<'scope, T> Unpin for Scope<'scope, T>
impl<'scope, T> UnsafeUnpin for Scope<'scope, T>
impl<'scope, T> !UnwindSafe for Scope<'scope, T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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