Struct rustdb::buf::ReadBufStg

source ·
pub struct ReadBufStg<const N: usize> { /* private fields */ }
Expand description

ReadBufStg buffers small (up to limit) reads to the underlying storage. Only supported functions are read and reset.

See implementation of AtomicFile for how this is used in conjunction with WMap.

N is buffer size.

Implementations§

source§

impl<const N: usize> ReadBufStg<N>

source

pub fn new(stg: Box<dyn Storage>, limit: usize, max_buf: usize) -> Box<Self>

Trait Implementations§

source§

impl<const N: usize> Storage for ReadBufStg<N>

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(&mut self, _start: u64, _data: &[u8])

Write byte slice to storage.
source§

fn commit(&mut self, _size: u64)

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

fn reset(&mut self)

Reset buffer
source§

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

Write byte Vec to storage.
source§

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

Write Data slice 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>

source§

fn wait_complete(&self)

Wait until current writes are complete.

Auto Trait Implementations§

§

impl<const N: usize> !RefUnwindSafe for ReadBufStg<N>

§

impl<const N: usize> Send for ReadBufStg<N>

§

impl<const N: usize> Sync for ReadBufStg<N>

§

impl<const N: usize> Unpin for ReadBufStg<N>

§

impl<const N: usize> !UnwindSafe for ReadBufStg<N>

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.