disklayer_ram

Struct RamDiskLayer

Source
pub struct RamDiskLayer { /* private fields */ }
Expand description

A disk layer backed entirely by RAM.

Implementations§

Source§

impl RamDiskLayer

Source

pub fn new(size: u64) -> Result<Self, Error>

Makes a new RAM disk layer of size bytes.

Trait Implementations§

Source§

impl Debug for RamDiskLayer

Source§

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

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

impl Inspect for RamDiskLayer

Source§

fn inspect(&self, req: Request<'_>)

Inspects the object.
Source§

impl LayerIo for RamDiskLayer

Source§

fn layer_type(&self) -> &str

Returns the layer type name as a string. Read more
Source§

fn sector_count(&self) -> u64

Returns the current sector count. Read more
Source§

fn sector_size(&self) -> u32

Returns the logical sector size of the backing store. Read more
Source§

fn is_logically_read_only(&self) -> bool

Returns true if the layer is logically read only. Read more
Source§

fn disk_id(&self) -> Option<[u8; 16]>

Optionally returns a 16-byte identifier for the disk, if there is a natural one for this backing store. Read more
Source§

fn physical_sector_size(&self) -> u32

Returns the physical sector size of the backing store. Read more
Source§

fn is_fua_respected(&self) -> bool

Returns true if the fua parameter to [LayerIo::write] is respected by the backing store by ensuring that the IO is immediately committed to disk.
Source§

async fn read( &self, buffers: &RequestBuffers<'_>, sector: u64, marker: SectorMarker<'_>, ) -> Result<(), DiskError>

Reads sectors from the layer. Read more
Source§

async fn write( &self, buffers: &RequestBuffers<'_>, sector: u64, _fua: bool, ) -> Result<(), DiskError>

Writes sectors to the layer. Read more
Source§

fn write_no_overwrite(&self) -> Option<impl WriteNoOverwrite>

Optionally returns a write-no-overwrite implementation.
Source§

async fn sync_cache(&self) -> Result<(), DiskError>

Issues an asynchronous flush operation to the disk.
Source§

async fn wait_resize(&self, sector_count: u64) -> u64

Waits for the disk sector size to be different than the specified value.
Source§

async fn unmap( &self, sector_offset: u64, sector_count: u64, _block_level_only: bool, next_is_zero: bool, ) -> Result<(), DiskError>

Unmap sectors from the layer. Read more
Source§

fn unmap_behavior(&self) -> UnmapBehavior

Returns the behavior of the unmap operation.
Source§

fn optimal_unmap_sectors(&self) -> u32

Returns the optimal granularity for unmaps, in sectors.
Source§

impl WriteNoOverwrite for RamDiskLayer

Source§

async fn write_no_overwrite( &self, buffers: &RequestBuffers<'_>, sector: u64, ) -> Result<(), DiskError>

Write to the layer without overwriting existing data. Existing sectors must be preserved. Read more

Auto Trait Implementations§

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.

§

impl<T> LayerAttach for T
where T: LayerIo,

§

type Error = Infallible

Error returned if on attach failure.
§

type Layer = T

Object implementating [LayerIo] after being attached.
§

async fn attach( self, _lower_layer_metadata: Option<DiskLayerMetadata>, ) -> Result<T, Infallible>

Invoked when the layer is being attached to a layer stack. 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