Skip to main content

SimDevice

Struct SimDevice 

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

The shared log’s segment files on the simulated disk (wal/), or its blob area’s files (blob/, which grow by appends; a crash resolves their pending writes like any others’, independently of the log’s).

Trait Implementations§

Source§

impl LogDevice for SimDevice

Source§

fn segments(&self) -> Result<Vec<u64>>

Segment numbers present, ascending.
Source§

fn len(&self, segment: u64) -> Result<u64>

Source§

fn read(&self, segment: u64, offset: u64, len: usize) -> Result<Vec<u8>>

Up to len bytes at offset, fewer at the end of the file.
Source§

fn create(&self, segment: u64, len: u64) -> Result<()>

Creates segment segment with len bytes, ready for overwrites, durably (file and directory entry).
Source§

fn write(&self, segment: u64, offset: u64, bytes: &[u8]) -> Result<()>

Writes at offset; durable only after sync.
Source§

fn sync(&self, segment: u64) -> Result<()>

Source§

fn rename(&self, from: u64, to: u64) -> Result<()>

Renames a segment file, durably.
Source§

fn remove(&self, segment: u64) -> Result<()>

Source§

fn prepare(&self, segment: u64, len: u64) -> Result<(), Error>

Like create, possibly in the background; any later operation on the segment waits for it.
Source§

fn is_ready(&self, _segment: u64) -> bool

Whether a prepared segment is ready: an operation on it now would not wait.

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.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.