pub struct File { /* private fields */ }Expand description
Use a plain file or host block device as a storage object.
Trait Implementations§
Source§impl Storage for File
impl Storage for File
Source§fn open_sync(opts: StorageOpenOptions) -> Result<Self>
fn open_sync(opts: StorageOpenOptions) -> Result<Self>
Available on crate feature
sync-wrappers only.Synchronous wrapper around
Storage::open().Source§async fn create_open(opts: StorageCreateOptions) -> Result<Self>
async fn create_open(opts: StorageCreateOptions) -> Result<Self>
Create a storage object and open it. Read more
Source§fn zero_align(&self) -> usize
fn zero_align(&self) -> usize
Minimum required alignment for zero writes.
Source§fn discard_align(&self) -> usize
fn discard_align(&self) -> usize
Minimum required alignment for effective discards.
Source§fn resolve_relative_path<P: AsRef<Path>>(&self, relative: P) -> Result<PathBuf>
fn resolve_relative_path<P: AsRef<Path>>(&self, relative: P) -> Result<PathBuf>
Resolve the given path relative to this storage object. Read more
Source§async unsafe fn pure_readv(
&self,
bufv: IoVectorMut<'_>,
offset: u64,
) -> Result<()>
async unsafe fn pure_readv( &self, bufv: IoVectorMut<'_>, offset: u64, ) -> Result<()>
Source§async unsafe fn pure_write_zeroes(&self, offset: u64, length: u64) -> Result<()>
async unsafe fn pure_write_zeroes(&self, offset: u64, length: u64) -> Result<()>
Ensure the given range reads back as zeroes. Read more
Source§async unsafe fn pure_write_allocated_zeroes(
&self,
offset: u64,
length: u64,
) -> Result<()>
async unsafe fn pure_write_allocated_zeroes( &self, offset: u64, length: u64, ) -> Result<()>
Ensure the given range is allocated, and reads back as zeroes. Read more
Source§async unsafe fn pure_discard(&self, offset: u64, length: u64) -> Result<()>
async unsafe fn pure_discard(&self, offset: u64, length: u64) -> Result<()>
Discard the given range, with undefined contents when read back. Read more
Source§async fn sync(&self) -> Result<()>
async fn sync(&self) -> Result<()>
Sync data already written to the storage hardware. Read more
Source§fn get_storage_helper(&self) -> &CommonStorageHelper
fn get_storage_helper(&self) -> &CommonStorageHelper
Return the storage helper object (used by the
StorageExt
implementation).Source§impl TryFrom<File> for File
impl TryFrom<File> for File
Source§fn try_from(file: File) -> Result<Self>
fn try_from(file: File) -> Result<Self>
Use the given existing std::fs::File.
Convert the given existing std::fs::File object into an imago storage object.
When using this, the resulting object will not know its own filename. That makes it impossible to auto-resolve relative paths to it, e.g. qcow2 backing file names.
Auto Trait Implementations§
impl !Freeze for File
impl RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnsafeUnpin for File
impl UnwindSafe for File
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
Source§impl<S> DynStorage for Swhere
S: Storage + 'static,
impl<S> DynStorage for Swhere
S: Storage + 'static,
Source§fn dyn_mem_align(&self) -> usize
fn dyn_mem_align(&self) -> usize
Wrapper around
Storage::mem_align().Source§fn dyn_req_align(&self) -> usize
fn dyn_req_align(&self) -> usize
Wrapper around
Storage::req_align().Source§fn dyn_zero_align(&self) -> usize
fn dyn_zero_align(&self) -> usize
Wrapper around
Storage::zero_align().Source§fn dyn_discard_align(&self) -> usize
fn dyn_discard_align(&self) -> usize
Wrapper around
Storage::discard_align().Source§fn dyn_resolve_relative_path(&self, relative: &Path) -> Result<PathBuf, Error>
fn dyn_resolve_relative_path(&self, relative: &Path) -> Result<PathBuf, Error>
Wrapper around
Storage::resolve_relative_path().Source§fn dyn_get_filename(&self) -> Option<PathBuf>
fn dyn_get_filename(&self) -> Option<PathBuf>
Wrapper around
Storage::get_filename()Source§unsafe fn dyn_pure_readv<'a>(
&'a self,
bufv: IoVectorMut<'a>,
offset: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'a>>
unsafe fn dyn_pure_readv<'a>( &'a self, bufv: IoVectorMut<'a>, offset: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'a>>
Object-safe wrapper around
Storage::pure_readv(). Read moreSource§unsafe fn dyn_pure_writev<'a>(
&'a self,
bufv: IoVector<'a>,
offset: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'a>>
unsafe fn dyn_pure_writev<'a>( &'a self, bufv: IoVector<'a>, offset: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'a>>
Object-safe wrapper around
Storage::pure_writev(). Read moreSource§unsafe fn dyn_pure_write_zeroes(
&self,
offset: u64,
length: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>
unsafe fn dyn_pure_write_zeroes( &self, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>
Object-safe wrapper around
Storage::pure_write_zeroes(). Read moreSource§unsafe fn dyn_pure_write_allocated_zeroes(
&self,
offset: u64,
length: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>
unsafe fn dyn_pure_write_allocated_zeroes( &self, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>
Object-safe wrapper around
Storage::pure_write_allocated_zeroes(). Read moreSource§unsafe fn dyn_pure_discard(
&self,
offset: u64,
length: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>
unsafe fn dyn_pure_discard( &self, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>
Object-safe wrapper around
Storage::pure_discard(). Read moreSource§fn dyn_flush(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>
fn dyn_flush(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>
Object-safe wrapper around
Storage::flush().Source§fn dyn_sync(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>
fn dyn_sync(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>
Object-safe wrapper around
Storage::sync().Source§unsafe fn dyn_invalidate_cache(
&self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>
unsafe fn dyn_invalidate_cache( &self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>
Object-safe wrapper around
Storage::invalidate_cache(). Read moreSource§fn dyn_get_storage_helper(&self) -> &CommonStorageHelper
fn dyn_get_storage_helper(&self) -> &CommonStorageHelper
Wrapper around
Storage::get_storage_helper().Source§fn dyn_resize(
&self,
new_size: u64,
prealloc_mode: PreallocateMode,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>
fn dyn_resize( &self, new_size: u64, prealloc_mode: PreallocateMode, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + '_>>
Wrapper around
Storage::resize().Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<S> StorageExt for Swhere
S: Storage,
impl<S> StorageExt for Swhere
S: Storage,
Source§async fn write_zeroes(&self, offset: u64, length: u64) -> Result<(), Error>
async fn write_zeroes(&self, offset: u64, length: u64) -> Result<(), Error>
Ensure the given range reads back as zeroes.
Source§async fn write_allocated_zeroes(
&self,
offset: u64,
length: u64,
) -> Result<(), Error>
async fn write_allocated_zeroes( &self, offset: u64, length: u64, ) -> Result<(), Error>
Ensure the given range is allocated and reads back as zeroes.
Source§async fn discard(&self, offset: u64, length: u64) -> Result<(), Error>
async fn discard(&self, offset: u64, length: u64) -> Result<(), Error>
Discard the given range, with undefined contents when read back. Read more
Source§async fn weak_write_blocker(&self, range: Range<u64>) -> RangeBlockedGuard<'_>
async fn weak_write_blocker(&self, range: Range<u64>) -> RangeBlockedGuard<'_>
Await concurrent strong write blockers for the given range. Read more
Source§async fn strong_write_blocker(&self, range: Range<u64>) -> RangeBlockedGuard<'_>
async fn strong_write_blocker(&self, range: Range<u64>) -> RangeBlockedGuard<'_>
Await any concurrent write request for the given range. Read more