Struct TableBuilder

Source
pub struct TableBuilder { /* private fields */ }
Expand description

| TableBuilder provides the interface used to | build a Table (an immutable and sorted map from | keys to values). | | Multiple threads can invoke const methods on | a TableBuilder without external | synchronization, but if any of the threads may | call a non-const method, all threads accessing | the same TableBuilder must use external | synchronization.

Implementations§

Source§

impl TableBuilder

Source

pub fn new(options: &Options, file: *mut dyn WritableFile) -> Self

| Create a builder that will store the contents | of the table it is building in *file. Does | not close the file. It is up to the caller | to close the file after calling Finish().

Source

pub fn change_options(&mut self, options: &Options) -> Status

| Change the options used by this builder. | Note: only some of the option fields can be | changed after construction. If a field is | not allowed to change dynamically and its | value in the structure passed to the | constructor is different from its value in | the structure passed to this method, this | method will return an error without changing | any fields.

Source

pub fn add(&mut self, key_: &Slice, value: &Slice)

| Add key,value to the table being constructed. | | REQUIRES: key is after any previously added | key according to comparator. | | REQUIRES: Finish(), Abandon() have not been | called

Source

pub fn flush(&mut self)

| Advanced operation: flush any buffered | key/value pairs to file. | | Can be used to ensure that two adjacent | entries never live in the same data block. | Most clients should not need to use this | method. | | REQUIRES: Finish(), Abandon() have not been | called

Source

pub fn write_block( &mut self, block: *mut BlockBuilder, handle: *mut BlockHandle, )

Source

pub fn write_raw_block( &mut self, block_contents: &Slice, ty: CompressionType, handle: *mut BlockHandle, )

Source

pub fn status(&self) -> Status

| Return non-ok iff some error has been | detected. |

Source

pub fn finish(&mut self) -> Status

| Finish building the table. Stops using the | file passed to the constructor after this | function returns. | | REQUIRES: Finish(), Abandon() have not been | called

Source

pub fn abandon(&mut self)

| Indicate that the contents of this builder | should be abandoned. Stops using the file | passed to the constructor after this function | returns. | | If the caller is not going to call Finish(), | it must call Abandon() before destroying this | builder. | | REQUIRES: Finish(), Abandon() have not been | called

Source

pub fn num_entries(&self) -> u64

| Number of calls to Add() so far. |

Source

pub fn file_size(&self) -> u64

| Size of the file generated so far. If | invoked after a successful Finish() | call, returns the size of the final generated | file. |

Source

pub fn ok(&self) -> bool

Trait Implementations§

Source§

impl Drop for TableBuilder

Source§

fn drop(&mut self)

| REQUIRES: Either Finish() or Abandon() | has been called. |

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, U> CastInto<U> for T
where U: CastFrom<T>,

Source§

unsafe fn cast_into(self) -> U

Performs the conversion. 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> StaticUpcast<T> for T

Source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V