pub struct Cluster { /* private fields */ }Expand description
A pool of config.concurrency pre-created tabs shared across tasks, with
per-task retries. Workers are reused between tasks, avoiding per-task
create/close overhead.
Implementations§
Source§impl Cluster
impl Cluster
Sourcepub async fn new(config: ClusterConfig) -> Result<Self>
pub async fn new(config: ClusterConfig) -> Result<Self>
Create config.concurrency tabs and enable Page/Runtime on each.
Sourcepub async fn execute<D, R, F, Fut>(&self, data: D, task: F) -> TaskResult<R>
pub async fn execute<D, R, F, Fut>(&self, data: D, task: F) -> TaskResult<R>
Run task on one available worker, retrying up to config.retries times on
failure. Blocks until a worker is free.
Sourcepub async fn run<D, R, F, Fut>(
&self,
items: impl IntoIterator<Item = D>,
task: F,
) -> Vec<TaskResult<R>>
pub async fn run<D, R, F, Fut>( &self, items: impl IntoIterator<Item = D>, task: F, ) -> Vec<TaskResult<R>>
Run task once per item in items, distributed across all workers
concurrently (bounded by config.concurrency). Order of results is
completion order, not input order.
Auto Trait Implementations§
impl !RefUnwindSafe for Cluster
impl !UnwindSafe for Cluster
impl Forget for Cluster
impl Freeze for Cluster
impl Send for Cluster
impl Sync for Cluster
impl Unpin for Cluster
impl UnsafeUnpin for Cluster
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