pub struct StreamExecutor { /* private fields */ }Expand description
Executes streaming operations with bounded concurrency.
Construct via StorageService::stream.
Each operation acquires a bulk permit individually; aggregate bulk
concurrency is bounded by the bulk semaphore on the limiter.
See the module documentation for the concurrency model.
Implementations§
Source§impl StreamExecutor
impl StreamExecutor
Sourcepub fn new(backend: Arc<dyn Backend>, concurrency: ConcurrencyLimiter) -> Self
pub fn new(backend: Arc<dyn Backend>, concurrency: ConcurrencyLimiter) -> Self
Creates a new StreamExecutor with the given backend and limiter.
Sourcepub fn execute<E>(
self,
context: ObjectContext,
operations: impl Stream<Item = (usize, Result<Operation, E>)> + Send + 'static,
) -> impl Stream<Item = (usize, Result<OpResponse, E>)> + Send + 'static
pub fn execute<E>( self, context: ObjectContext, operations: impl Stream<Item = (usize, Result<Operation, E>)> + Send + 'static, ) -> impl Stream<Item = (usize, Result<OpResponse, E>)> + Send + 'static
Executes the operations stream with bounded concurrency.
Each item is a (index, Result<Operation, E>) tuple where index is the
0-based position of the operation in the original request. Error items pass
through immediately; successful items acquire a bulk permit and execute
in an isolated [tokio::spawn].
Permit acquisition is sequential — only one acquire is in flight at a time, ensuring fairness with other streams and preventing a large batch from racing for all permits at once. Execution of operations that already hold a permit proceeds concurrently.
Operations that cannot acquire a permit within the configured queue
timeout fail with Error::AtCapacity. Results are yielded in
completion order (not submission order).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StreamExecutor
impl !RefUnwindSafe for StreamExecutor
impl Send for StreamExecutor
impl Sync for StreamExecutor
impl Unpin for StreamExecutor
impl UnsafeUnpin for StreamExecutor
impl !UnwindSafe for StreamExecutor
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
§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>
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].