pub struct CachedDiskWriter { /* private fields */ }Implementations§
Source§impl CachedDiskWriter
impl CachedDiskWriter
Sourcepub fn new(
path: &Path,
total_size: Option<u64>,
cache_size_mb: Option<usize>,
) -> Self
pub fn new( path: &Path, total_size: Option<u64>, cache_size_mb: Option<usize>, ) -> Self
Create a new CachedDiskWriter using PositionedDiskWriter (pwrite/seek_write)
as the underlying I/O strategy.
This is the default constructor; use new_with_mmap
to select the memory-mapped strategy instead.
Sourcepub fn new_with_mmap(
path: &Path,
total_size: Option<u64>,
cache_size_mb: Option<usize>,
use_mmap: bool,
) -> Self
pub fn new_with_mmap( path: &Path, total_size: Option<u64>, cache_size_mb: Option<usize>, use_mmap: bool, ) -> Self
Create a new CachedDiskWriter with explicit control over the I/O strategy.
§Arguments
path- Output file path.total_size- Expected total file size, used for pre-allocation.cache_size_mb- Optional write-back cache size in megabytes.use_mmap- Iftrue, useMmapDiskWriter(memory-mapped I/O); otherwise usePositionedDiskWriter(positionedpwrite/seek_write).
pub fn open_existing(path: &Path) -> Result<Self>
Sourcepub fn with_rate_limiter(self, limiter: Arc<RateLimiter>) -> Self
pub fn with_rate_limiter(self, limiter: Arc<RateLimiter>) -> Self
Attach a rate limiter for write throttling. Uses non-blocking try_acquire: if tokens unavailable, writes proceed without blocking.
pub fn is_opened(&self) -> bool
Trait Implementations§
Source§impl SeekableDiskWriter for CachedDiskWriter
impl SeekableDiskWriter for CachedDiskWriter
Source§fn write_bytes_at<'life0, 'async_trait>(
&'life0 mut self,
offset: u64,
data: Bytes,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write_bytes_at<'life0, 'async_trait>(
&'life0 mut self,
offset: u64,
data: Bytes,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Zero-copy write: accepts Bytes directly. When caching, the Bytes is moved into the cache (O(1) refcount bump). When direct-writing, the Bytes is passed by reference to pwrite (no copy).
fn open<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write_at<'life0, 'life1, 'async_trait>(
&'life0 mut self,
offset: u64,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_at<'life0, 'life1, 'async_trait>(
&'life0 mut self,
offset: u64,
buf: &'life1 mut [u8],
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn truncate<'life0, 'async_trait>(
&'life0 mut self,
length: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn flush<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn path(&self) -> &Path
Auto Trait Implementations§
impl !RefUnwindSafe for CachedDiskWriter
impl !UnwindSafe for CachedDiskWriter
impl Freeze for CachedDiskWriter
impl Send for CachedDiskWriter
impl Sync for CachedDiskWriter
impl Unpin for CachedDiskWriter
impl UnsafeUnpin for CachedDiskWriter
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