pub struct DisabledDiskIo;Expand description
No-op disk I/O backend for network throughput benchmarking.
All writes succeed silently, reads return zeroed bytes, and hash verifications always pass.
Trait Implementations§
Source§impl DiskIoBackend for DisabledDiskIo
impl DiskIoBackend for DisabledDiskIo
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
Human-readable backend name (e.g., “posix”, “mmap”, “disabled”).
Source§fn register(&self, _info_hash: Id20, _storage: Arc<dyn TorrentStorage>)
fn register(&self, _info_hash: Id20, _storage: Arc<dyn TorrentStorage>)
Register a torrent’s storage for I/O operations.
Source§fn unregister(&self, _info_hash: Id20)
fn unregister(&self, _info_hash: Id20)
Unregister a torrent’s storage.
Source§fn write_chunk(
&self,
_info_hash: Id20,
_piece: u32,
_begin: u32,
_data: Bytes,
_flush: bool,
) -> Result<()>
fn write_chunk( &self, _info_hash: Id20, _piece: u32, _begin: u32, _data: Bytes, _flush: bool, ) -> Result<()>
Write a chunk of piece data. If
flush is true, persist immediately. Read moreSource§fn read_chunk(
&self,
_info_hash: Id20,
_piece: u32,
_begin: u32,
length: u32,
_volatile: bool,
) -> Result<Bytes>
fn read_chunk( &self, _info_hash: Id20, _piece: u32, _begin: u32, length: u32, _volatile: bool, ) -> Result<Bytes>
Read a chunk of piece data.
volatile hints the data won’t be re-read soon. Read moreSource§fn read_piece(&self, _info_hash: Id20, _piece: u32) -> Result<Vec<u8>>
fn read_piece(&self, _info_hash: Id20, _piece: u32) -> Result<Vec<u8>>
Read an entire piece from storage, returning its raw bytes. Read more
Source§fn hash_piece(
&self,
_info_hash: Id20,
_piece: u32,
_expected: &Id20,
) -> Result<bool>
fn hash_piece( &self, _info_hash: Id20, _piece: u32, _expected: &Id20, ) -> Result<bool>
Verify a piece against its expected SHA-1 hash. Read more
Source§fn hash_piece_v2(
&self,
_info_hash: Id20,
_piece: u32,
_expected: &Id32,
) -> Result<bool>
fn hash_piece_v2( &self, _info_hash: Id20, _piece: u32, _expected: &Id32, ) -> Result<bool>
Verify a piece against its expected SHA-256 hash (BEP 52). Read more
Source§fn hash_block(
&self,
_info_hash: Id20,
_piece: u32,
_begin: u32,
_length: u32,
) -> Result<Id32>
fn hash_block( &self, _info_hash: Id20, _piece: u32, _begin: u32, _length: u32, ) -> Result<Id32>
Compute SHA-256 hash of a single block within a piece (BEP 52 Merkle). Read more
Source§fn clear_piece(&self, _info_hash: Id20, _piece: u32)
fn clear_piece(&self, _info_hash: Id20, _piece: u32)
Discard buffered data for a piece (e.g., after hash failure).
Source§fn flush_piece(&self, _info_hash: Id20, _piece: u32) -> Result<()>
fn flush_piece(&self, _info_hash: Id20, _piece: u32) -> Result<()>
Flush buffered writes for a piece to persistent storage. Read more
Source§fn cached_pieces(&self, _info_hash: Id20) -> Vec<u32>
fn cached_pieces(&self, _info_hash: Id20) -> Vec<u32>
Return piece indices currently held in cache (for
SuggestPiece, M44).Source§fn stats(&self) -> DiskIoStats
fn stats(&self) -> DiskIoStats
Return current I/O statistics.
Auto Trait Implementations§
impl Freeze for DisabledDiskIo
impl RefUnwindSafe for DisabledDiskIo
impl Send for DisabledDiskIo
impl Sync for DisabledDiskIo
impl Unpin for DisabledDiskIo
impl UnsafeUnpin for DisabledDiskIo
impl UnwindSafe for DisabledDiskIo
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