pub struct Raw<S: Storage + 'static> {
inner: S,
writable: bool,
size: AtomicU64,
}
Expand description
Wraps a storage object without any translation.
Fields§
§inner: S
Wrapped storage object.
writable: bool
Whether this image may be modified.
size: AtomicU64
Disk size, which is the file size when this object was created.
Implementations§
Source§impl<S: Storage + 'static> Raw<S>
impl<S: Storage + 'static> Raw<S>
Sourcepub fn builder(image: S) -> RawOpenBuilder<S>
pub fn builder(image: S) -> RawOpenBuilder<S>
Create a new FormatDriverBuilder
instance for the given image.
Sourcepub fn builder_path<P: AsRef<Path>>(image_path: P) -> RawOpenBuilder<S>
pub fn builder_path<P: AsRef<Path>>(image_path: P) -> RawOpenBuilder<S>
Create a new FormatDriverBuilder
instance for an image under the given path.
Sourcepub fn create_builder(image: S) -> RawCreateBuilder<S>
pub fn create_builder(image: S) -> RawCreateBuilder<S>
Create a new FormatCreateBuilder
instance for the given file.
Sourcepub async fn open_image(inner: S, writable: bool) -> Result<Self>
pub async fn open_image(inner: S, writable: bool) -> Result<Self>
Wrap inner
, allowing it to be used as a disk image in raw format.
Sourcepub async fn open_path<P: AsRef<Path>>(path: P, writable: bool) -> Result<Self>
pub async fn open_path<P: AsRef<Path>>(path: P, writable: bool) -> Result<Self>
Open the given path as a storage object, and wrap it in Raw
.
Sourcepub fn open_image_sync(inner: S, writable: bool) -> Result<Self>
pub fn open_image_sync(inner: S, writable: bool) -> Result<Self>
Wrap inner
, allowing it to be used as a disk image in raw format.
Sourcepub fn open_path_sync<P: AsRef<Path>>(path: P, writable: bool) -> Result<Self>
pub fn open_path_sync<P: AsRef<Path>>(path: P, writable: bool) -> Result<Self>
Synchronous wrapper around Raw::open_path()
.
Trait Implementations§
Source§impl<S: Storage + 'static> FormatDriverInstance for Raw<S>
impl<S: Storage + 'static> FormatDriverInstance for Raw<S>
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,
Check whether
storage
has this format. Read moreSource§fn zero_granularity(&self) -> Option<u64>
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>
fn collect_storage_dependencies(&self) -> Vec<&S>
Recursively collect all storage objects associated with this image. 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,
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 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 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,
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,
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§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,
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,
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§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,
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,
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,
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,
format_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,
format_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,
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 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,
Read data from a
ShallowMapping::Special
area.Auto Trait Implementations§
impl<S> !Freeze for Raw<S>
impl<S> RefUnwindSafe for Raw<S>where
S: RefUnwindSafe,
impl<S> Send for Raw<S>
impl<S> Sync for Raw<S>
impl<S> Unpin for Raw<S>where
S: Unpin,
impl<S> UnwindSafe for Raw<S>where
S: UnwindSafe,
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