pub struct WriteBatch { /* private fields */ }
Expand description

An atomic batch of write operations.

Making an atomic commit of several writes:

use rocksdb::{DB, Options, WriteBatch};

let path = "_path_for_rocksdb_storage1";
{
    let db = DB::open_default(path).unwrap();
    let mut batch = WriteBatch::default();
    batch.put(b"my key", b"my value");
    batch.put(b"key2", b"value2");
    batch.put(b"key3", b"value3");
    db.write(batch); // Atomically commits the batch
}
let _ = DB::destroy(&Options::default(), path);

Implementations

Return WriteBatch serialized size (in bytes).

Iterate the put and delete operations within this write batch. Note that this does not return an Iterator but instead will invoke the put() and delete() member functions of the provided WriteBatchIterator trait implementation.

Insert a value into the database under the given key.

Removes the database entry for key. Does nothing if the key was not found.

Remove database entries from start key to end key.

Removes the database entries in the range [“begin_key”, “end_key”), i.e., including “begin_key” and excluding “end_key”. It is not an error if no keys exist in the range [“begin_key”, “end_key”).

Remove database entries in column family from start key to end key.

Removes the database entries in the range [“begin_key”, “end_key”), i.e., including “begin_key” and excluding “end_key”. It is not an error if no keys exist in the range [“begin_key”, “end_key”).

Clear all updates buffered in this batch.

Trait Implementations

Returns the “default value” for a type. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.