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: StorageOpenOptionsBase options to be used for implicitly opened storage objects.
size: AtomicU64Virtual disk size in bytes.
desc: VmdkDescParsed 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>
impl<S: Storage + 'static, F: WrappedFormat<S> + 'static> Vmdk<S, F>
Sourcepub fn builder(image: S) -> VmdkOpenBuilder<S, F>
pub fn builder(image: S) -> VmdkOpenBuilder<S, F>
Create a new FormatDriverBuilder instance for the given image.
Sourcepub fn builder_path<P: AsRef<Path>>(image_path: P) -> VmdkOpenBuilder<S, F>
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.
Sourceasync fn open_implicit_extent<G: ImplicitOpenGate<S>>(
&self,
extent: &VmdkParsedExtent,
in_disk_offset: u64,
open_gate: &mut G,
) -> Result<VmdkExtent<S>>
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.
Sourcefn error_out_unsupported_version(&self) -> Result<()>
fn error_out_unsupported_version(&self) -> Result<()>
Checks if the VMDK version is supported and returns an error if not
Sourcefn parse_descriptor_line(&mut self, line: &str) -> Result<()>
fn parse_descriptor_line(&mut self, line: &str) -> Result<()>
Parse a line in the VMDK descriptor file
Sourceasync fn parse_descriptor_file(&mut self) -> Result<()>
async fn parse_descriptor_file(&mut self) -> Result<()>
Read and parse the VMDK descriptor by reading in lines until we find the end
Sourceasync fn do_open(
descriptor_file: S,
storage_open_options: StorageOpenOptions,
) -> Result<Self>
async fn do_open( descriptor_file: S, storage_open_options: StorageOpenOptions, ) -> Result<Self>
Internal implementation for opening a VMDK image.
Sourcepub async fn open_image(descriptor_file: S, writable: bool) -> Result<Self>
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().
Sourcepub async fn open_implicit_dependencies_gated<G: ImplicitOpenGate<S>>(
&mut self,
gate: G,
) -> Result<()>
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.
Sourcefn get_extent_at(&self, offset: u64) -> Option<&VmdkExtent<S>>
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>
impl<S: Debug + Storage + 'static, F: Debug + WrappedFormat<S> + 'static> Debug for Vmdk<S, F>
Source§impl<S: Storage + 'static, F: WrappedFormat<S> + 'static> FormatDriverInstance for Vmdk<S, F>
impl<S: Storage + 'static, F: WrappedFormat<S> + 'static> FormatDriverInstance for Vmdk<S, F>
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,
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,
storage has this format. Read moreSource§fn zero_granularity(&self) -> Option<u64>
fn zero_granularity(&self) -> Option<u64>
Source§fn collect_storage_dependencies(&self) -> Vec<&S>
fn collect_storage_dependencies(&self) -> Vec<&S>
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,
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,
offset. Read moreSource§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,
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,
Source§fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn sync<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn sync<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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,
unsafe fn invalidate_cache<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
ShallowMapping::Special area.