pub struct ConcurrentExecutor { /* private fields */ }Expand description
Executes tasks concurrently with configurable concurrency limits.
The executor manages parallel execution of tasks while respecting concurrency limits and completion criteria.
Implementations§
Source§impl ConcurrentExecutor
impl ConcurrentExecutor
Sourcepub fn new(
total_tasks: usize,
max_concurrency: Option<usize>,
completion_config: CompletionConfig,
) -> Self
pub fn new( total_tasks: usize, max_concurrency: Option<usize>, completion_config: CompletionConfig, ) -> Self
Creates a new ConcurrentExecutor.
§Arguments
total_tasks- Total number of tasks to executemax_concurrency- Maximum concurrent tasks (None = unlimited)completion_config- Configuration for completion criteria
Sourcepub fn counters(&self) -> &Arc<ExecutionCounters>
pub fn counters(&self) -> &Arc<ExecutionCounters>
Returns a reference to the execution counters.
Sourcepub fn completion_notify(&self) -> &Arc<Notify>
pub fn completion_notify(&self) -> &Arc<Notify>
Returns a reference to the completion notify.
Sourcepub fn should_complete(&self) -> Option<CompletionReason>
pub fn should_complete(&self) -> Option<CompletionReason>
Checks if the operation should complete based on current state.
Sourcepub fn record_success(&self) -> Option<CompletionReason>
pub fn record_success(&self) -> Option<CompletionReason>
Records a successful task completion and checks for overall completion.
Returns Some(CompletionReason) if the operation should now complete.
Sourcepub fn record_failure(&self) -> Option<CompletionReason>
pub fn record_failure(&self) -> Option<CompletionReason>
Records a failed task and checks for overall completion.
Returns Some(CompletionReason) if the operation should now complete.
Sourcepub fn record_suspend(&self) -> Option<CompletionReason>
pub fn record_suspend(&self) -> Option<CompletionReason>
Records a suspended task and checks for overall completion.
Returns Some(CompletionReason) if the operation should now complete.
Sourcepub async fn execute<T, F, Fut>(self, tasks: Vec<F>) -> BatchResult<T>
pub async fn execute<T, F, Fut>(self, tasks: Vec<F>) -> BatchResult<T>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConcurrentExecutor
impl !RefUnwindSafe for ConcurrentExecutor
impl Send for ConcurrentExecutor
impl Sync for ConcurrentExecutor
impl Unpin for ConcurrentExecutor
impl UnsafeUnpin for ConcurrentExecutor
impl !UnwindSafe for ConcurrentExecutor
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
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>
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>
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