Struct speedb::SstFileWriter

source ·
pub struct SstFileWriter<'a> { /* private fields */ }
Expand description

SstFileWriter is used to create sst files that can be added to database later All keys in files generated by SstFileWriter will have sequence number = 0.

Implementations§

source§

impl<'a> SstFileWriter<'a>

source

pub fn create(opts: &'a Options) -> Self

Initializes SstFileWriter with given DB options.

source

pub fn open<P: AsRef<Path>>(&'a self, path: P) -> Result<(), Error>

Prepare SstFileWriter to write into file located at “file_path”.

source

pub fn finish(&mut self) -> Result<(), Error>

Finalize writing to sst file and close file.

source

pub fn file_size(&self) -> u64

returns the current file size

source

pub fn put<K, V>(&mut self, key: K, value: V) -> Result<(), Error>
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Adds a Put key with value to currently opened file REQUIRES: key is after any previously added key according to comparator.

source

pub fn merge<K, V>(&mut self, key: K, value: V) -> Result<(), Error>
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Adds a Merge key with value to currently opened file REQUIRES: key is after any previously added key according to comparator.

source

pub fn delete<K: AsRef<[u8]>>(&mut self, key: K) -> Result<(), Error>

Adds a deletion key to currently opened file REQUIRES: key is after any previously added key according to comparator.

Trait Implementations§

source§

impl<'a> Drop for SstFileWriter<'a>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'a> Send for SstFileWriter<'a>

source§

impl<'a> Sync for SstFileWriter<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for SstFileWriter<'a>

§

impl<'a> Unpin for SstFileWriter<'a>

§

impl<'a> UnwindSafe for SstFileWriter<'a>

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.