Struct Vmdk

Source
pub struct Vmdk<S: Storage + 'static, F: WrappedFormat<S> + 'static = FormatAccess<S>> {
    descriptor_file: Arc<S>,
    parent_type: PhantomData<F>,
    storage_open_options: StorageOpenOptions,
    size: AtomicU64,
    desc: VmdkDesc,
    parsed_extents: Vec<VmdkParsedExtent>,
    extents: Vec<VmdkExtent<S>>,
}
Expand description

VMDK disk image format implementation.

Fields§

§descriptor_file: Arc<S>

Storage object containing the VMDK descriptor file

§parent_type: PhantomData<F>

Backing image type.

We do not support backing (parent) images yet, but capture the type so that when we do support it, the change will be syntactically compatible.

§storage_open_options: StorageOpenOptions

Base options to be used for implicitly opened storage objects.

§size: AtomicU64

Virtual disk size in bytes.

§desc: VmdkDesc

Parsed VMDK descriptor.

§parsed_extents: Vec<VmdkParsedExtent>

Extent information as parsed from the VMDK descriptor file.

§extents: Vec<VmdkExtent<S>>

Storage objects for each extent.

Implementations§

Source§

impl<S: Storage + 'static, F: WrappedFormat<S> + 'static> Vmdk<S, F>

Source

pub fn builder(image: S) -> VmdkOpenBuilder<S, F>

Create a new FormatDriverBuilder instance for the given image.

Source

pub fn builder_path<P: AsRef<Path>>(image_path: P) -> VmdkOpenBuilder<S, F>

Create a new FormatDriverBuilder instance for an image under the given path.

Source

async fn open_implicit_extent<G: ImplicitOpenGate<S>>( &self, extent: &VmdkParsedExtent, in_disk_offset: u64, open_gate: &mut G, ) -> Result<VmdkExtent<S>>

Open an extent from the information in extent.

in_disk_offset is the offset in the virtual disk where this extent fits in. It should be the end offset of the extent before it.

Source

fn error_out_unsupported_version(&self) -> Result<()>

Checks if the VMDK version is supported and returns an error if not

Source

fn parse_descriptor_line(&mut self, line: &str) -> Result<()>

Parse a line in the VMDK descriptor file

Source

async fn parse_descriptor_file(&mut self) -> Result<()>

Read and parse the VMDK descriptor by reading in lines until we find the end

Source

async fn do_open( descriptor_file: S, storage_open_options: StorageOpenOptions, ) -> Result<Self>

Internal implementation for opening a VMDK image.

Source

pub async fn open_image(descriptor_file: S, writable: bool) -> Result<Self>

Opens a VMDK file.

This will not open any other storage objects needed, i.e. no extent data files. Handling those manually is not yet supported, so you have to make use of the implicit references given in the image header, for which you can use Vmdk::open_implicit_dependencies_gated().

Source

pub async fn open_implicit_dependencies_gated<G: ImplicitOpenGate<S>>( &mut self, gate: G, ) -> Result<()>

Open all implicit dependencies.

In the case of VMDK, these are the extent data files.

Source

fn get_extent_at(&self, offset: u64) -> Option<&VmdkExtent<S>>

Return the extent covering offset, if any.

Trait Implementations§

Source§

impl<S: Debug + Storage + 'static, F: Debug + WrappedFormat<S> + 'static> Debug for Vmdk<S, F>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<S: Storage + 'static, F: WrappedFormat<S> + 'static> Display for Vmdk<S, F>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<S: Storage + 'static, F: WrappedFormat<S> + 'static> FormatDriverInstance for Vmdk<S, F>

Source§

type Storage = S

Type of storage used.
Source§

fn format(&self) -> Format

Return which format this is.
Source§

unsafe fn probe<'life0, 'async_trait>( storage: &'life0 S, ) -> Pin<Box<dyn Future<Output = Result<bool>> + 'async_trait>>
where Self: Sized + 'async_trait, 'life0: 'async_trait,

Check whether storage has this format. Read more
Source§

fn size(&self) -> u64

Size of the disk represented by this image.
Source§

fn zero_granularity(&self) -> Option<u64>

Granularity on which blocks can be marked as zero. Read more
Source§

fn collect_storage_dependencies(&self) -> Vec<&S>

Recursively collect all storage objects associated with this image. Read more
Source§

fn writable(&self) -> bool

Return whether this image may be modified. Read more
Source§

fn get_mapping<'a, 'async_trait>( &'a self, offset: u64, max_length: u64, ) -> Pin<Box<dyn Future<Output = Result<(ShallowMapping<'a, S>, u64)>> + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Return the mapping at offset. Read more
Source§

fn ensure_data_mapping<'a, 'async_trait>( &'a self, _offset: u64, _length: u64, _overwrite: bool, ) -> Pin<Box<dyn Future<Output = Result<(&'a S, u64, u64)>> + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Ensure that offset is directly mapped to some storage object, up to a length of length. Read more
Source§

fn flush<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Flush internal buffers. Read more
Source§

fn sync<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sync data already written to the storage hardware. Read more
Source§

unsafe fn invalidate_cache<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Drop internal buffers. Read more
Source§

fn resize_grow<'life0, 'async_trait>( &'life0 self, _new_size: u64, _prealloc_mode: PreallocateMode, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Resize to the given size, which must be greater than the current size. Read more
Source§

fn resize_shrink<'life0, 'async_trait>( &'life0 mut self, _new_size: u64, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Truncate to the given size, which must be smaller than the current size. Read more
Source§

fn ensure_zero_mapping<'life0, 'async_trait>( &'life0 self, _offset: u64, _length: u64, ) -> Pin<Box<dyn Future<Output = Result<(u64, u64)>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Ensure that the given range is efficiently mapped as zeroes. Read more
Source§

fn discard_to_zero<'life0, 'async_trait>( &'life0 mut self, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = Result<(u64, u64)>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Discard the given range, ensure it is read back as zeroes. Read more
Source§

unsafe fn discard_to_zero_unsafe<'life0, 'async_trait>( &'life0 self, _offset: u64, _length: u64, ) -> Pin<Box<dyn Future<Output = Result<(u64, u64)>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Discard the given range, ensure it is read back as zeroes. Read more
Source§

fn discard_to_any<'life0, 'async_trait>( &'life0 mut self, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = Result<(u64, u64)>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Discard the given range. Read more
Source§

unsafe fn discard_to_any_unsafe<'life0, 'async_trait>( &'life0 self, _offset: u64, _length: u64, ) -> Pin<Box<dyn Future<Output = Result<(u64, u64)>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Discard the given range. Read more
Source§

fn discard_to_backing<'life0, 'async_trait>( &'life0 mut self, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = Result<(u64, u64)>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Discard the given range, such that the backing image becomes visible. Read more
Source§

unsafe fn discard_to_backing_unsafe<'life0, 'async_trait>( &'life0 self, _offset: u64, _length: u64, ) -> Pin<Box<dyn Future<Output = Result<(u64, u64)>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Discard the given range, such that the backing image becomes visible. Read more
Source§

fn readv_special<'life0, 'life1, 'async_trait>( &'life0 self, _bufv: IoVectorMut<'life1>, _offset: u64, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read data from a ShallowMapping::Special area.

Auto Trait Implementations§

§

impl<S, F = FormatAccess<S>> !Freeze for Vmdk<S, F>

§

impl<S, F> RefUnwindSafe for Vmdk<S, F>

§

impl<S, F> Send for Vmdk<S, F>

§

impl<S, F> Sync for Vmdk<S, F>

§

impl<S, F> Unpin for Vmdk<S, F>
where F: Unpin, S: Unpin,

§

impl<S, F> UnwindSafe for Vmdk<S, F>

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more