pub struct Qcow2Dev<T> {
pub info: Qcow2Info,
/* private fields */
}Fields§
§info: Qcow2InfoImplementations§
Source§impl<T: Qcow2IoOps> Qcow2Dev<T>
impl<T: Qcow2IoOps> Qcow2Dev<T>
pub fn new( path: &Path, header: Qcow2Header, params: &Qcow2DevParams, file: T, ) -> Qcow2Result<Self>
Sourcepub fn set_backing_dev(&mut self, back: Box<Qcow2Dev<T>>)
pub fn set_backing_dev(&mut self, back: Box<Qcow2Dev<T>>)
Setup the backing Qcow2 device
Sourcepub fn refblock_cache_is_empty(&self) -> bool
pub fn refblock_cache_is_empty(&self) -> bool
if the refblock cache for holding refcount block slice is empty
Sourcepub fn l2_cache_is_empty(&self) -> bool
pub fn l2_cache_is_empty(&self) -> bool
if the l2 cache for holding l2 slice is empty
Sourcepub async fn shrink_caches(&self) -> Qcow2Result<()>
pub async fn shrink_caches(&self) -> Qcow2Result<()>
shrink both refblock and l2 caches, so the memory can be released, often called when qcow2 device is idle
Sourcepub async fn fsync_range(&self, off: u64, len: usize) -> Qcow2Result<()>
pub async fn fsync_range(&self, off: u64, len: usize) -> Qcow2Result<()>
for flushing data in the qcow2 virtual range to disk
Sourcepub async fn flush_meta(&self) -> Qcow2Result<()>
pub async fn flush_meta(&self) -> Qcow2Result<()>
flush meta data in ram to disk
pub async fn get_mapping(&self, virtual_offset: u64) -> Qcow2Result<Mapping>
Sourcepub async fn read_at(&self, buf: &mut [u8], offset: u64) -> Qcow2Result<usize>
pub async fn read_at(&self, buf: &mut [u8], offset: u64) -> Qcow2Result<usize>
Read data to buf from the virtual offset of this qcow2 image
Sourcepub async fn write_at(&self, buf: &[u8], offset: u64) -> Qcow2Result<()>
pub async fn write_at(&self, buf: &[u8], offset: u64) -> Qcow2Result<()>
Write data in buf to the virtual offset of this qcow2 image
Sourcepub fn need_flush_meta(&self) -> bool
pub fn need_flush_meta(&self) -> bool
Helper for checking if there is dirty meta data which needs to be flushed to disk
Sourcepub async fn qcow2_cluster_usage<F>(&self, cls_usage: F) -> Qcow2Result<()>
pub async fn qcow2_cluster_usage<F>(&self, cls_usage: F) -> Qcow2Result<()>
Return Host Cluster usage, such as, allocated clusters, how many of them are compressed, …
Sourcepub async fn check(&self) -> Qcow2Result<()>
pub async fn check(&self) -> Qcow2Result<()>
Check Qcow2 meta integrity and cluster leak
Sourcepub fn qcow2_prep_io<'life_self, 'async_recursion>(
&'life_self self,
) -> Pin<Box<dyn Future<Output = Qcow2Result<()>> + 'async_recursion>>where
'life_self: 'async_recursion,
pub fn qcow2_prep_io<'life_self, 'async_recursion>(
&'life_self self,
) -> Pin<Box<dyn Future<Output = Qcow2Result<()>> + 'async_recursion>>where
'life_self: 'async_recursion,
Prepare everything(loading l1/refcount table) for handling any qcow2 IO
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Qcow2Dev<T>
impl<T> !RefUnwindSafe for Qcow2Dev<T>
impl<T> Send for Qcow2Dev<T>where
T: Send,
impl<T> !Sync for Qcow2Dev<T>
impl<T> Unpin for Qcow2Dev<T>where
T: Unpin,
impl<T> !UnwindSafe for Qcow2Dev<T>
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