pub struct BeePool { /* private fields */ }Expand description
Pool of bees that routes tasks to idle workers.
Implementations§
Source§impl BeePool
impl BeePool
Sourcepub fn new(config: &NodeConfig) -> Self
pub fn new(config: &NodeConfig) -> Self
Create a new BeePool with N bees (N = config.cores), each with memory_per_bee budget.
Sourcepub async fn queue_size(&self) -> usize
pub async fn queue_size(&self) -> usize
Return the current number of queued tasks.
Sourcepub async fn busy_count(&self) -> usize
pub async fn busy_count(&self) -> usize
Return the current number of busy bees.
Sourcepub fn avg_memory_utilisation(&self) -> f64
pub fn avg_memory_utilisation(&self) -> f64
Return the average memory utilization across all bees.
Sourcepub async fn submit<F>(
&self,
func: F,
) -> JoinHandle<Result<Vec<RecordBatch>, ApiaryError>>
pub async fn submit<F>( &self, func: F, ) -> JoinHandle<Result<Vec<RecordBatch>, ApiaryError>>
Submit a task to the pool. If all bees are busy the task is queued. Returns the task result via the returned JoinHandle.
When colony temperature indicates Critical state (> 0.95), tasks are rejected immediately to protect the system from overload.
Auto Trait Implementations§
impl Freeze for BeePool
impl !RefUnwindSafe for BeePool
impl Send for BeePool
impl Sync for BeePool
impl Unpin for BeePool
impl UnsafeUnpin for BeePool
impl !UnwindSafe for BeePool
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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