Trait timely::worker::AsWorker

source ·
pub trait AsWorker: Scheduler {
    // Required methods
    fn config(&self) -> &Config;
    fn index(&self) -> usize;
    fn peers(&self) -> usize;
    fn allocate<T: Data>(
        &mut self,
        identifier: usize,
        address: &[usize]
    ) -> (Vec<Box<dyn Push<Message<T>>>>, Box<dyn Pull<Message<T>>>);
    fn pipeline<T: 'static>(
        &mut self,
        identifier: usize,
        address: &[usize]
    ) -> (ThreadPusher<Message<T>>, ThreadPuller<Message<T>>);
    fn new_identifier(&mut self) -> usize;
    fn log_register(&self) -> RefMut<'_, Registry<WorkerIdentifier>>;

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


fn config(&self) -> &Config

Returns the worker configuration parameters.


fn index(&self) -> usize

Index of the worker among its peers.


fn peers(&self) -> usize

Number of peer workers.


fn allocate<T: Data>( &mut self, identifier: usize, address: &[usize] ) -> (Vec<Box<dyn Push<Message<T>>>>, Box<dyn Pull<Message<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.


fn pipeline<T: 'static>( &mut self, identifier: usize, address: &[usize] ) -> (ThreadPusher<Message<T>>, ThreadPuller<Message<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 overriden to be more efficient.


fn new_identifier(&mut self) -> usize

Allocates a new worker-unique identifier.


fn log_register(&self) -> RefMut<'_, Registry<WorkerIdentifier>>

Provides access to named logging streams.

Provided Methods§


fn logging(&self) -> Option<TimelyLogger>

Provides access to the timely logging stream.

Object Safety§

This trait is not object safe.



impl<'a, G, T> AsWorker for Child<'a, G, T>


impl<A: Allocate> AsWorker for Worker<A>