Struct rustdb::dividedstg::DividedStg

source ·
pub struct DividedStg {
    pub bs: BlockStg,
    pub blk_cap: u64,
    /* private fields */
}
Expand description

Divides Storage into sub-files of arbitrary size using BlockStg.

Fields§

§bs: BlockStg

Underlying block storage.

§blk_cap: u64

Block capacity.

Implementations§

source§

impl DividedStg

source

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

Construct DividedStg from specified Storage and block capacity.

source

pub fn new_file(&mut self) -> FD

Get file descriptor for a new file.

source

pub fn drop_file(&mut self, f: &mut FD)

Drop specified file.

source

pub fn truncate(&mut self, f: &mut FD, size: u64)

Free blocks not required for file of specified size.

source

pub fn write(&mut self, f: &mut FD, offset: u64, data: &[u8])

Write data to specified file at specified offset.

source

pub fn write_data(&mut self, f: &mut FD, offset: u64, data: Data, n: usize)

Write Data to specified file at specified offset.

source

pub fn read(&self, f: &FD, offset: u64, data: &mut [u8])

Read data from file at specified offset.

source

pub fn save_fd(&self, fd: &FD, buf: &mut [u8])

Save fd to byte buffer.

source

pub fn load_fd(&self, buf: &[u8]) -> FD

Load fd from byte buffer.

source

pub fn set_root(&mut self, fd: &FD)

Set root file descriptor.

source

pub fn get_root(&self) -> FD

Get root file descriptor.

source

pub fn save(&mut self)

Save files to backing storage.

source

pub fn wait_complete(&self)

Wait for save to complete.

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.