pub struct Controller<K, V, R>{ /* private fields */ }
Expand description
The Controller is a non-producing handle to the scheduler. It allows creation of new channels as well as clearing of queues.
Implementations§
Source§impl<K, V, R> Controller<K, V, R>
impl<K, V, R> Controller<K, V, R>
Sourcepub fn channel(&self, key: K, bound: usize) -> Sender<V>
pub fn channel(&self, key: K, bound: usize) -> Sender<V>
Create a new channel, returns the producer site. See below for bound. May block if clearing or scheduling tick is currently running.
§Bound
Is the next power of two for the handed value
Sourcepub fn cancel_channel(&self, key: &K) -> Result<(), ()>
pub fn cancel_channel(&self, key: &K) -> Result<(), ()>
Clear queue for specific channel & running jobs if supported.
May block if channel
is called or a schedule is running.
Note that for a queue with bounds n, it has a O(n) worst case complexity.
Returns Err if the specified channel is invalid.
Sourcepub fn gc(&self)
pub fn gc(&self)
Manually trigger schedule. Normaly not required but if you should drop a lot of channels and don’t insert/complete a job in the next time, you may call this.
Sourcepub fn set_worker_max(&self, max_workers: usize)
pub fn set_worker_max(&self, max_workers: usize)
Change maximum amount of workers.
Takes effect on next schedule.
Sourcepub fn get_worker_max(&self) -> usize
pub fn get_worker_max(&self) -> usize
Returns currently set max amount of workers.
Trait Implementations§
Source§impl<K, V, R> Clone for Controller<K, V, R>
impl<K, V, R> Clone for Controller<K, V, R>
Source§fn clone(&self) -> Controller<K, V, R>
fn clone(&self) -> Controller<K, V, R>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more