Struct Qcow2Dev

Source
pub struct Qcow2Dev<T> {
    pub info: Qcow2Info,
    /* private fields */
}

Fields§

§info: Qcow2Info

Implementations§

Source§

impl<T: Qcow2IoOps> Qcow2Dev<T>

Source

pub fn new( path: &Path, header: Qcow2Header, params: &Qcow2DevParams, file: T, ) -> Qcow2Result<Self>

Source

pub fn set_backing_dev(&mut self, back: Box<Qcow2Dev<T>>)

Setup the backing Qcow2 device

Source

pub fn refblock_cache_is_empty(&self) -> bool

if the refblock cache for holding refcount block slice is empty

Source

pub fn l2_cache_is_empty(&self) -> bool

if the l2 cache for holding l2 slice is empty

Source

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

Source

pub async fn fsync_range(&self, off: u64, len: usize) -> Qcow2Result<()>

for flushing data in the qcow2 virtual range to disk

Source

pub async fn flush_meta(&self) -> Qcow2Result<()>

flush meta data in ram to disk

Source

pub async fn get_mapping(&self, virtual_offset: u64) -> Qcow2Result<Mapping>

Source

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

Source

pub async fn write_at(&self, buf: &[u8], offset: u64) -> Qcow2Result<()>

Write data in buf to the virtual offset of this qcow2 image

Source

pub fn need_flush_meta(&self) -> bool

Helper for checking if there is dirty meta data which needs to be flushed to disk

Source

pub async fn qcow2_cluster_usage<F>(&self, cls_usage: F) -> Qcow2Result<()>
where F: Fn(&str, &Vec<&RangeInclusive<u64>>, Option<(usize, usize)>),

Return Host Cluster usage, such as, allocated clusters, how many of them are compressed, …

Source

pub async fn check(&self) -> Qcow2Result<()>

Check Qcow2 meta integrity and cluster leak

Source

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§

Source§

impl<T> Debug for Qcow2Dev<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.