Struct veloren_common::slowjob::InternalSlowJobPool
source · struct InternalSlowJobPool {
next_id: u64,
queue: HashMap<String, VecDeque<Queue>>,
configs: HashMap<String, Config>,
last_spawned_configs: Vec<String>,
global_spawned_and_running: u64,
global_limit: u64,
jobs_metrics_cnt: usize,
jobs_metrics: HashMap<String, Vec<JobMetrics>>,
threadpool: Arc<ThreadPool>,
internal: Option<Arc<Mutex<Self>>>,
}
Fields§
§next_id: u64
§queue: HashMap<String, VecDeque<Queue>>
§configs: HashMap<String, Config>
§last_spawned_configs: Vec<String>
§global_spawned_and_running: u64
§global_limit: u64
§jobs_metrics_cnt: usize
§jobs_metrics: HashMap<String, Vec<JobMetrics>>
§threadpool: Arc<ThreadPool>
§internal: Option<Arc<Mutex<Self>>>
Implementations§
source§impl InternalSlowJobPool
impl InternalSlowJobPool
pub fn new( global_limit: u64, jobs_metrics_cnt: usize, _threadpool: Arc<ThreadPool>, ) -> Arc<Mutex<Self>>
sourcefn calc_queued_order(
&self,
queued: HashMap<&String, u64>,
limit: usize,
) -> Vec<String>
fn calc_queued_order( &self, queued: HashMap<&String, u64>, limit: usize, ) -> Vec<String>
returns order of configuration which are queued next
fn can_spawn(&self, name: &str) -> bool
pub fn spawn<F>(&mut self, name: &str, f: F) -> SlowJob
fn finish(&mut self, name: &str, metrics: JobMetrics)
fn spawn_queued(&mut self)
pub fn take_metrics(&mut self) -> HashMap<String, Vec<JobMetrics>>
Auto Trait Implementations§
impl Freeze for InternalSlowJobPool
impl !RefUnwindSafe for InternalSlowJobPool
impl Send for InternalSlowJobPool
impl Sync for InternalSlowJobPool
impl Unpin for InternalSlowJobPool
impl !UnwindSafe for InternalSlowJobPool
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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