pub struct UnorderedWriter { /* private fields */ }Expand description
Writer that delivers completed data terms in arbitrary order.
Each call to set_next_term_data_source
spawns a task (tracked via a JoinSet) that resolves the data future and
sends the result through an mpsc channel. The consumer
(typically an UnorderedDownloadStream)
reads from the receiver end and gets items in whatever order tasks complete.
The consumer stream holds only Arc<UnorderedWriterProgress>, not the writer
itself, so the writer’s channel sender is dropped naturally when the
reconstruction task finishes and consumes the writer via
finish().
Trait Implementations§
Source§impl DataWriter for UnorderedWriter
impl DataWriter for UnorderedWriter
Source§fn set_next_term_data_source<'life0, 'async_trait>(
&'life0 mut self,
byte_range: FileRange,
permit: Option<AdjustableSemaphorePermit>,
data_future: Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'static>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_next_term_data_source<'life0, 'async_trait>(
&'life0 mut self,
byte_range: FileRange,
permit: Option<AdjustableSemaphorePermit>,
data_future: Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'static>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sets the data source for the next sequential term. Read more
Source§fn finish<'async_trait>(
self: Box<Self>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
fn finish<'async_trait>(
self: Box<Self>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
Consumes the writer, waits until all data has been written, and returns the
number of bytes written. Dropping the writer without calling
finish cancels
the reconstruction via the shared run state.Auto Trait Implementations§
impl Freeze for UnorderedWriter
impl RefUnwindSafe for UnorderedWriter
impl Send for UnorderedWriter
impl Sync for UnorderedWriter
impl Unpin for UnorderedWriter
impl UnsafeUnpin for UnorderedWriter
impl UnwindSafe for UnorderedWriter
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
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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>
Converts
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>
Converts
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