Struct BasicAtomicFile

Source
pub struct BasicAtomicFile {
    pub map: WMap,
    /* private fields */
}
Expand description

Basis for crate::AtomicFile ( unbuffered alternative ).

Fields§

§map: WMap

Map of writes.

Implementations§

Source§

impl BasicAtomicFile

Source

pub fn new( stg: Box<dyn Storage>, upd: Box<dyn Storage>, lim: &Limits, ) -> Box<Self>

stg is the main underlying storage, upd is temporary storage for updates during commit.

Source

pub fn commit_phase(&mut self, size: u64, phase: u8)

Perform the specified phase ( 1 or 2 ) of a two-phase commit.

Trait Implementations§

Source§

impl Storage for BasicAtomicFile

Source§

fn commit(&mut self, size: u64)

Finish write transaction, size is new size of underlying storage.
Source§

fn size(&self) -> u64

Get the size of the underlying storage. Note : this is valid initially and after a commit but is not defined after write is called.
Source§

fn read(&self, start: u64, data: &mut [u8])

Read data from storage.
Source§

fn write_data(&mut self, start: u64, data: Data, off: usize, len: usize)

Write Data slice to storage.
Source§

fn write(&mut self, start: u64, data: &[u8])

Write byte slice to storage.
Source§

fn write_vec(&mut self, start: u64, data: Vec<u8>)

Write byte Vec to storage.
Source§

fn write_u64(&mut self, start: u64, value: u64)

Write u64 to storage.
Source§

fn read_u64(&self, start: u64) -> u64

Read u64 from storage.
Source§

fn clone(&self) -> Box<dyn Storage>

Clone.
Source§

fn wait_complete(&self)

Wait until current writes are complete.
Source§

fn reset(&mut self)

Reset buffer

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, 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.