pub struct BlobStreamOut { /* private fields */ }
Expand description
Manages the streaming out of binary blob data, split into fixed-size chunks.
BlobStreamOut
keeps track of which chunks have been sent, the time they were sent,
and controls resending based on elapsed time since the last send.
Implementations§
Source§impl BlobStreamOut
impl BlobStreamOut
Sourcepub fn new(chunk_count: usize, resend_duration: Duration) -> Self
pub fn new(chunk_count: usize, resend_duration: Duration) -> Self
Creates a new BlobStreamOut
instance.
§Arguments
chunk_count
- The total number of chunks.resend_duration
- The minimum time that must elapse before resending a chunk.blob
- The complete binary data to be streamed out.
§Returns
A new BlobStreamOut
initialized with the provided chunk size, resend duration, and blob data.
§Panics
This function will panic if fixed_chunk_size
is zero.
pub fn chunk_count(&self) -> usize
Sourcepub fn set_waiting_for_chunk_index(
&mut self,
index: usize,
receive_mask: u64,
) -> Result<(), OutStreamError>
pub fn set_waiting_for_chunk_index( &mut self, index: usize, receive_mask: u64, ) -> Result<(), OutStreamError>
Sets the starting index from which to send the next chunk.
§Arguments
index
- The starting index of the next chunk to be sent.
Sourcepub fn send(&mut self, now: Instant, max_count: usize) -> Vec<usize>
pub fn send(&mut self, now: Instant, max_count: usize) -> Vec<usize>
Sends up to max_count
chunks, starting from the configured start_index_to_send
.
Resends chunks if enough time has passed since their last send, or fills in additional
chunks if the number of filtered chunks is less than max_count
.
§Arguments
now
- The current time used for calculating elapsed time.max_count
- The maximum number of chunks to send in this batch.
§Returns
A vector containing up to max_count
BlobStreamOutEntry
items, representing the chunks to be sent.