pub struct DcpStream { /* private fields */ }Expand description
DCP Stream with integrity verification
Implementations§
Source§impl DcpStream
impl DcpStream
Sourcepub fn new(stream_id: u32, capacity: usize) -> Self
pub fn new(stream_id: u32, capacity: usize) -> Self
Create a new DCP stream with the given buffer capacity
Sourcepub fn buffer(&self) -> &StreamRingBuffer
pub fn buffer(&self) -> &StreamRingBuffer
Get the underlying buffer
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if the stream is complete
Sourcepub fn write_chunk(
&self,
data: &[u8],
is_last: bool,
) -> Result<StreamChunk, DCPError>
pub fn write_chunk( &self, data: &[u8], is_last: bool, ) -> Result<StreamChunk, DCPError>
Write a chunk to the stream (producer side) Returns the chunk header that should be sent
Sourcepub fn read_chunk(&self) -> Result<Option<(StreamChunk, Vec<u8>)>, DCPError>
pub fn read_chunk(&self) -> Result<Option<(StreamChunk, Vec<u8>)>, DCPError>
Read a chunk from the stream (consumer side) Returns the chunk header and data, or None if no data available
Sourcepub fn verify_checksum(&self, expected: &[u8; 32]) -> bool
pub fn verify_checksum(&self, expected: &[u8; 32]) -> bool
Verify the stream checksum against an expected value
Sourcepub fn request_retransmit(&self, missing_seq: u32) -> RetransmitRequest
pub fn request_retransmit(&self, missing_seq: u32) -> RetransmitRequest
Create a retransmission request for missing chunks
Sourcepub fn next_expected_seq(&self) -> u32
pub fn next_expected_seq(&self) -> u32
Get the next expected sequence number
Sourcepub fn next_send_seq(&self) -> u32
pub fn next_send_seq(&self) -> u32
Get the next sequence number to send
Sourcepub fn is_backpressure(&self) -> bool
pub fn is_backpressure(&self) -> bool
Check if backpressure is active
Sourcepub fn available_space(&self) -> usize
pub fn available_space(&self) -> usize
Get available buffer space
Auto Trait Implementations§
impl !Freeze for DcpStream
impl RefUnwindSafe for DcpStream
impl Send for DcpStream
impl Sync for DcpStream
impl Unpin for DcpStream
impl UnsafeUnpin for DcpStream
impl UnwindSafe for DcpStream
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