pub struct StreamExecutor {
    pub ok_events_avg_future_duration: AtomicIncrementalAverage64,
    pub timed_out_events_avg_future_duration: AtomicIncrementalAverage64,
    pub failed_events_avg_future_duration: AtomicIncrementalAverage64,
    /* private fields */
}
Expand description

Fields§

§ok_events_avg_future_duration: AtomicIncrementalAverage64

computes: counter of successful events & average times (seconds) for the future resolution

§timed_out_events_avg_future_duration: AtomicIncrementalAverage64

computes: counter of timed out events & average times (seconds) for the failed future resolution (even if it should be ~ constant) – events computed here are NOT computed at [failed_events_avg_future_duration]

§failed_events_avg_future_duration: AtomicIncrementalAverage64

computes: counter of all other failed events & average times (seconds) for the failed future resolution (timed out events, computed by [timed_out_events_avg_future_duration], are NOT computed here)

Implementations§

source§

impl StreamExecutor

source

pub fn new<IntoString: Into<String>>(executor_name: IntoString) -> Arc<Self>

Initializes an executor that should not timeout any futures returned by the Stream

source

pub fn with_futures_timeout<IntoString: Into<String>>( executor_name: IntoString, futures_timeout: Duration ) -> Arc<Self>

Initializes an executor that should be able to timeout Futures returned by the Stream

source

pub fn executor_name(&self) -> String

source

pub fn report_scheduled_to_finish(&self)

Tells this executor that its Stream will be artificially ended – so to cause it to cease its execution

source

pub fn spawn_executor<const INSTRUMENTS: usize, OutItemType: Send + Debug, FutureItemType: Future<Output = Result<OutItemType, Box<dyn Error + Send + Sync>>> + Send, CloseVoidAsyncType: Future<Output = ()> + Send + 'static, ErrVoidAsyncType: Future<Output = ()> + Send + 'static>( self: Arc<Self>, concurrency_limit: u32, on_err_callback: impl Fn(Box<dyn Error + Send + Sync>) -> ErrVoidAsyncType + Send + Sync + 'static, stream_ended_callback: impl FnOnce(Arc<StreamExecutor>) -> CloseVoidAsyncType + Send + Sync + 'static, stream: impl Stream<Item = FutureItemType> + 'static + Send )

Spawns an optimized executor for a Stream of ItemTypes which are:

  • Futures – ItemType := Future<Output=InnerFallibleType>
  • Fallible – InnerFallibleType := Result<InnerType, Box<dyn std::error::Error>>.
    NOTE: special (optimized) versions are spawned depending if we should or not enforce each item’s Future a resolution timeout
source

pub fn spawn_futures_executor<const INSTRUMENTS: usize, OutItemType: Send + Debug, FutureItemType: Future<Output = OutItemType> + Send, CloseVoidAsyncType: Future<Output = ()> + Send + 'static>( self: Arc<Self>, concurrency_limit: u32, stream_ended_callback: impl FnOnce(Arc<StreamExecutor>) -> CloseVoidAsyncType + Send + Sync + 'static, stream: impl Stream<Item = FutureItemType> + 'static + Send )

Spawns an optimized executor for a Stream of FutureItemTypes (non fallible Futures).
NOTE: Since this is non-fallible, timeouts are enforced but not detectable. If that is not acceptable, use Self::spawn_executor() instead

source

pub fn spawn_fallibles_executor<const INSTRUMENTS: usize, OutItemType: Send + Debug, CloseVoidAsyncType: Future<Output = ()> + Send + 'static>( self: Arc<Self>, concurrency_limit: u32, on_err_callback: impl Fn(Box<dyn Error + Send + Sync>) + Send + Sync + 'static, stream_ended_callback: impl FnOnce(Arc<StreamExecutor>) -> CloseVoidAsyncType + Send + Sync + 'static, stream: impl Stream<Item = Result<OutItemType, Box<dyn Error + Send + Sync>>> + 'static + Send )

Spawns an optimized executor for a Stream of FallibleItemTypes, where:

  • FallibleItemType := Result<OutItemType, Box<dyn std::error::Error + Send + Sync>>
source

pub fn spawn_non_futures_executor<const INSTRUMENTS: usize, ItemType: Send + Debug, VoidAsyncType: Future<Output = ()> + Send + 'static>( self: Arc<Self>, concurrency_limit: u32, stream_ended_callback: impl FnOnce(Arc<StreamExecutor>) -> VoidAsyncType + Send + Sync + 'static, stream: impl Stream<Item = Result<ItemType, Box<dyn Error + Send + Sync>>> + 'static + Send )

Spawns an executor for a Stream of ItemTypes which are not Futures but are fallible:

  • InnerFallibleType := Result<ItemType, Box<dyn std::error::Error>>
source

pub fn spawn_non_futures_non_fallibles_executor<const INSTRUMENTS: usize, OutItemType: Send + Debug, VoidAsyncType: Future<Output = ()> + Send + 'static>( self: Arc<Self>, concurrency_limit: u32, stream_ended_callback: impl FnOnce(Arc<StreamExecutor>) -> VoidAsyncType + Send + Sync + 'static, stream: impl Stream<Item = OutItemType> + 'static + Send )

Spawns an optimized executor for a Stream of ItemTypes which are not Futures and, also, are not fallible

Trait Implementations§

source§

impl Debug for StreamExecutor

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Erased for T