pub struct PosixDiskIo { /* private fields */ }Expand description
POSIX disk I/O backend with unified buffer pool (combined read cache + write buffer under a single byte budget).
Replaces the previous separate ArcCache + WriteBuffer design with
a single [BufferPool] that uses a byte-budget ARC for read caching and
tracks in-flight writes as Writing entries.
Implementations§
Source§impl PosixDiskIo
impl PosixDiskIo
Sourcepub fn new(config: &DiskConfig) -> Self
pub fn new(config: &DiskConfig) -> Self
Create a new POSIX disk I/O backend with the given configuration.
Trait Implementations§
Source§impl DiskIoBackend for PosixDiskIo
impl DiskIoBackend for PosixDiskIo
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 PosixDiskIo
impl !RefUnwindSafe for PosixDiskIo
impl Send for PosixDiskIo
impl Sync for PosixDiskIo
impl Unpin for PosixDiskIo
impl UnsafeUnpin for PosixDiskIo
impl !UnwindSafe for PosixDiskIo
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