pub struct AppendSession { /* private fields */ }Expand description
A session for high-throughput appending with backpressure control. It can be created from
append_session.
Supports pipelining multiple AppendInputs while preserving submission order.
Implementations§
Source§impl AppendSession
impl AppendSession
Sourcepub async fn submit(
&self,
input: AppendInput,
) -> Result<BatchSubmitTicket, S2Error>
pub async fn submit( &self, input: AppendInput, ) -> Result<BatchSubmitTicket, S2Error>
Submit a batch of records for appending.
Internally, it waits on reserve, then submits using the permit.
This provides backpressure when inflight limits are reached.
For explicit control, use reserve followed by
BatchSubmitPermit::submit.
Note: After all submits, you must call close to ensure all batches are
appended.
Sourcepub async fn reserve(&self, bytes: u32) -> Result<BatchSubmitPermit, S2Error>
pub async fn reserve(&self, bytes: u32) -> Result<BatchSubmitPermit, S2Error>
Reserve capacity for a batch to be submitted. Useful in select! loops
where you want to interleave submission with other async work. See submit
for a simpler API.
Waits when inflight limits are reached, providing explicit backpressure control. The returned permit must be used to submit the batch.
Note: After all submits, you must call close to ensure all batches are
appended.
§Cancel safety
This method is cancel safe. Internally, it only awaits
Semaphore::acquire_many_owned and
Sender::reserve_owned, both of which are cancel
safe.
Auto Trait Implementations§
impl Freeze for AppendSession
impl !RefUnwindSafe for AppendSession
impl Send for AppendSession
impl Sync for AppendSession
impl Unpin for AppendSession
impl !UnwindSafe for AppendSession
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