pub struct MmapDiskIo { /* private fields */ }Expand description
Memory-mapped disk I/O backend with no user-space cache.
Relies entirely on the kernel page cache via mmap. All reads and writes go directly to storage with no write buffering.
Implementations§
Source§impl MmapDiskIo
impl MmapDiskIo
Trait Implementations§
Source§impl Default for MmapDiskIo
impl Default for MmapDiskIo
Source§impl DiskIoBackend for MmapDiskIo
impl DiskIoBackend for MmapDiskIo
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 MmapDiskIo
impl !RefUnwindSafe for MmapDiskIo
impl Send for MmapDiskIo
impl Sync for MmapDiskIo
impl Unpin for MmapDiskIo
impl UnsafeUnpin for MmapDiskIo
impl !UnwindSafe for MmapDiskIo
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