pub trait AsWorker: Scheduler {
// Required methods
fn config(&self) -> &Config;
fn index(&self) -> usize;
fn peers(&self) -> usize;
fn allocate<T: Exchangeable>(
&mut self,
identifier: usize,
address: Rc<[usize]>,
) -> (Vec<Box<dyn Push<T>>>, Box<dyn Pull<T>>);
fn pipeline<T: 'static>(
&mut self,
identifier: usize,
address: Rc<[usize]>,
) -> (ThreadPusher<T>, ThreadPuller<T>);
fn new_identifier(&mut self) -> usize;
fn peek_identifier(&self) -> usize;
fn log_register(&self) -> RefMut<'_, Registry>;
// Provided method
fn logging(&self) -> Option<TimelyLogger> { ... }
}
Expand description
Methods provided by the root Worker.
These methods are often proxied by child scopes, and this trait provides access.
Required Methods§
sourcefn allocate<T: Exchangeable>(
&mut self,
identifier: usize,
address: Rc<[usize]>,
) -> (Vec<Box<dyn Push<T>>>, Box<dyn Pull<T>>)
fn allocate<T: Exchangeable>( &mut self, identifier: usize, address: Rc<[usize]>, ) -> (Vec<Box<dyn Push<T>>>, Box<dyn Pull<T>>)
Allocates a new channel from a supplied identifier and address.
The identifier is used to identify the underlying channel and route its data. It should be distinct from other identifiers passed used for allocation, but can otherwise be arbitrary.
The address should specify a path to an operator that should be scheduled in response to the receipt of records on the channel. Most commonly, this would be the address of the target of the channel.
sourcefn pipeline<T: 'static>(
&mut self,
identifier: usize,
address: Rc<[usize]>,
) -> (ThreadPusher<T>, ThreadPuller<T>)
fn pipeline<T: 'static>( &mut self, identifier: usize, address: Rc<[usize]>, ) -> (ThreadPusher<T>, ThreadPuller<T>)
Constructs a pipeline channel from the worker to itself.
By default this method uses the native channel allocation mechanism, but the expectation is that this behavior will be overridden to be more efficient.
sourcefn new_identifier(&mut self) -> usize
fn new_identifier(&mut self) -> usize
Allocates a new worker-unique identifier.
sourcefn peek_identifier(&self) -> usize
fn peek_identifier(&self) -> usize
The next worker-unique identifier to be allocated.
sourcefn log_register(&self) -> RefMut<'_, Registry>
fn log_register(&self) -> RefMut<'_, Registry>
Provides access to named logging streams.
Provided Methods§
sourcefn logging(&self) -> Option<TimelyLogger>
fn logging(&self) -> Option<TimelyLogger>
Provides access to the timely logging stream.