Struct rustdb::atomfile::AtomicFile

source ·
pub struct AtomicFile { /* private fields */ }
Expand description

Based on BasicAtomicFile which makes sure that database updates are all-or-nothing. Provides read buffering for small reads, and a thread to perform commit asyncronously.

Implementations§

source§

impl AtomicFile

source

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

Construct AtomicFile with default limits. stg is the main underlying storage, upd is temporary storage for updates during commit.

source

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

Construct Atomic file with specified limits.

Trait Implementations§

source§

impl Storage for AtomicFile

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 wait_complete(&self)

Wait until current writes are complete.
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 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>,

§

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

§

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.