[][src]Struct rocks::write_batch::WriteBatch

pub struct WriteBatch { /* fields omitted */ }

WriteBatch holds a collection of updates to apply atomically to a DB.

Implementations

impl WriteBatch[src]

pub fn new() -> WriteBatch[src]

pub fn with_reserved_bytes(reserved_bytes: usize) -> WriteBatch[src]

pub fn clear(&mut self)[src]

Clear all updates buffered in this batch.

pub fn put(&mut self, key: &[u8], value: &[u8]) -> &mut Self[src]

Store the mapping "key->value" in the database.

pub fn put_cf(
    &mut self,
    column_family: &ColumnFamilyHandle,
    key: &[u8],
    value: &[u8]
) -> &mut Self
[src]

pub fn putv(&mut self, key: &[&[u8]], value: &[&[u8]]) -> &mut Self[src]

Variant of Put() that gathers output like writev(2). The key and value that will be written to the database are concatentations of arrays of slices.

pub fn putv_cf(
    &mut self,
    column_family: &ColumnFamilyHandle,
    key: &[&[u8]],
    value: &[&[u8]]
) -> &mut Self
[src]

pub fn delete(&mut self, key: &[u8]) -> &mut Self[src]

If the database contains a mapping for "key", erase it. Else do nothing.

pub fn delete_cf(
    &mut self,
    column_family: &ColumnFamilyHandle,
    key: &[u8]
) -> &mut Self
[src]

pub fn deletev(&mut self, key: &[&[u8]]) -> &mut Self[src]

variant that takes SliceParts

pub fn deletev_cf(
    &mut self,
    column_family: &ColumnFamilyHandle,
    key: &[&[u8]]
) -> &mut Self
[src]

pub fn single_delete(&mut self, key: &[u8]) -> &mut Self[src]

WriteBatch implementation of DB::SingleDelete(). See db.h.

pub fn single_delete_cf(
    &mut self,
    column_family: &ColumnFamilyHandle,
    key: &[u8]
) -> &mut Self
[src]

pub fn single_deletev(&mut self, key: &[&[u8]]) -> &mut Self[src]

variant that takes SliceParts

pub fn single_deletev_cf(
    &mut self,
    column_family: &ColumnFamilyHandle,
    key: &[&[u8]]
) -> &mut Self
[src]

pub fn delete_range(&mut self, begin_key: &[u8], end_key: &[u8]) -> &mut Self[src]

WriteBatch implementation of DB::DeleteRange(). See db.h.

pub fn delete_range_cf(
    &mut self,
    column_family: &ColumnFamilyHandle,
    begin_key: &[u8],
    end_key: &[u8]
) -> &mut Self
[src]

pub fn deletev_range(
    &mut self,
    begin_key: &[&[u8]],
    end_key: &[&[u8]]
) -> &mut Self
[src]

variant that takes SliceParts

pub fn deletev_range_cf(
    &mut self,
    column_family: &ColumnFamilyHandle,
    begin_key: &[&[u8]],
    end_key: &[&[u8]]
) -> &mut Self
[src]

pub fn merge(&mut self, key: &[u8], value: &[u8]) -> &mut Self[src]

Merge "value" with the existing value of "key" in the database. "key->merge(existing, value)"

pub fn merge_cf(
    &mut self,
    column_family: &ColumnFamilyHandle,
    key: &[u8],
    value: &[u8]
) -> &mut Self
[src]

pub fn mergev(&mut self, key: &[&[u8]], value: &[&[u8]]) -> &mut Self[src]

pub fn mergev_cf(
    &mut self,
    column_family: &ColumnFamilyHandle,
    key: &[&[u8]],
    value: &[&[u8]]
) -> &mut Self
[src]

pub fn put_log_data(&mut self, blob: &[u8]) -> &mut Self[src]

Append a blob of arbitrary size to the records in this batch. The blob will be stored in the transaction log but not in any other file. In particular, it will not be persisted to the SST files. When iterating over this WriteBatch, WriteBatch::Handler::LogData will be called with the contents of the blob as it is encountered. Blobs, puts, deletes, and merges will be encountered in the same order in thich they were inserted. The blob will NOT consume sequence number(s) and will NOT increase the count of the batch

Example application: add timestamps to the transaction log for use in replication.

pub fn set_save_point(&mut self) -> &mut Self[src]

Records the state of the batch for future calls to RollbackToSavePoint(). May be called multiple times to set multiple save points.

pub fn rollback_to_save_point(&mut self) -> Result<()>[src]

Remove all entries in this batch (Put, Merge, Delete, PutLogData) since the most recent call to SetSavePoint() and removes the most recent save point. If there is no previous call to SetSavePoint(), Status::NotFound() will be returned. Otherwise returns Status::OK().

pub fn pop_save_point(&mut self) -> Result<()>[src]

Pop the most recent save point. If there is no previous call to SetSavePoint(), Status::NotFound() will be returned. Otherwise returns Status::OK().

pub fn iterate<H: WriteBatchHandler>(&self, handler: &mut H) -> Result<()>[src]

Support for iterating over the contents of a batch.

pub fn get_data(&self) -> &[u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Retrieve the serialized version of this batch.

pub fn get_data_size(&self) -> usize[src]

pub fn count(&self) -> usize[src]

Returns the number of updates in the batch

pub fn has_put(&self) -> bool[src]

Returns true if PutCF will be called during Iterate

pub fn has_delete(&self) -> bool[src]

Returns true if DeleteCF will be called during Iterate

pub fn has_single_delete(&self) -> bool[src]

Returns true if SingleDeleteCF will be called during Iterate

pub fn has_delete_range(&self) -> bool[src]

Returns true if DeleteRangeCF will be called during Iterate

pub fn has_merge(&self) -> bool[src]

Returns true if MergeCF will be called during Iterate

pub fn has_begin_prepare(&self) -> bool[src]

Returns true if MarkBeginPrepare will be called during Iterate

pub fn has_end_prepare(&self) -> bool[src]

Returns true if MarkEndPrepare will be called during Iterate

pub fn has_commit(&self) -> bool[src]

Returns trie if MarkCommit will be called during Iterate

pub fn has_rollback(&self) -> bool[src]

Returns trie if MarkRollback will be called during Iterate

Trait Implementations

impl Clone for WriteBatch[src]

impl Debug for WriteBatch[src]

impl Default for WriteBatch[src]

impl Drop for WriteBatch[src]

impl Send for WriteBatch[src]

impl Sync for WriteBatch[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.