pub struct WorkerPool { /* private fields */ }Implementations§
Source§impl WorkerPool
impl WorkerPool
Sourcepub async fn spawn(
manifest_json: &[u8],
worker_entry: PathBuf,
n: usize,
) -> Result<Arc<Self>, WorkerError>
pub async fn spawn( manifest_json: &[u8], worker_entry: PathBuf, n: usize, ) -> Result<Arc<Self>, WorkerError>
Spawn n workers loading manifest_path and start the watchdog.
Sourcepub async fn spawn_with_config(
manifest_json: &[u8],
worker_entry: PathBuf,
n: usize,
config_path: Option<PathBuf>,
) -> Result<Arc<Self>, WorkerError>
pub async fn spawn_with_config( manifest_json: &[u8], worker_entry: PathBuf, n: usize, config_path: Option<PathBuf>, ) -> Result<Arc<Self>, WorkerError>
Like spawn, but passes config_path to each worker so its render
entrypoints can reach adapters declared in mesofact.config.toml.
Sourcepub fn attach_metrics(&self, metrics: Arc<Metrics>)
pub fn attach_metrics(&self, metrics: Arc<Metrics>)
Attach the shared metrics registry so respawns bump the restarting
worker-pool gauge. Called once after both the pool and AppState exist.
Sourcepub async fn live_count(&self) -> usize
pub async fn live_count(&self) -> usize
Live worker count — the ready worker-pool gauge, read at scrape time.
Sourcepub async fn get(&self) -> Option<Arc<WorkerClient>>
pub async fn get(&self) -> Option<Arc<WorkerClient>>
Return a live worker, round-robin across the pool. Per-worker I/O still
serializes on that worker’s socket mutex (see worker_client cleanup),
so spreading requests across workers is what buys real concurrency.
Auto Trait Implementations§
impl !Freeze for WorkerPool
impl !RefUnwindSafe for WorkerPool
impl !UnwindSafe for WorkerPool
impl Send for WorkerPool
impl Sync for WorkerPool
impl Unpin for WorkerPool
impl UnsafeUnpin for WorkerPool
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