Struct rocksdb::TransactionDB

source ·
pub struct TransactionDB<T: ThreadMode = SingleThreaded> { /* private fields */ }
Expand description

RocksDB TransactionDB.

Please read the official guide to learn more about RocksDB TransactionDB.

The default thread mode for TransactionDB is SingleThreaded if feature multi-threaded-cf is not enabled.

use rocksdb::{DB, Options, TransactionDB, SingleThreaded};
let path = "_path_for_transaction_db";
{
    let db: TransactionDB = TransactionDB::open_default(path).unwrap();
    db.put(b"my key", b"my value").unwrap();
     
    // create transaction
    let txn = db.transaction();
    txn.put(b"key2", b"value2");
    txn.put(b"key3", b"value3");
    txn.commit().unwrap();
}
let _ = DB::destroy(&Options::default(), path);

Implementations§

Opens a database with default options.

Opens the database with the specified options.

Opens a database with the given database options and column family names.

Column families opened using this function will be created with default Options.

Opens a database with the given database options and column family descriptors.

Creates a transaction with default options.

Creates a transaction with options.

Get all prepared transactions for recovery.

This function is expected to call once after open database. User should commit or rollback all transactions before start other transactions.

Returns the bytes associated with a key value.

Returns the bytes associated with a key value and the given column family.

Returns the bytes associated with a key value with read options.

Returns the bytes associated with a key value and the given column family with read options.

Returns the bytes associated with a key value and the given column family.

Returns the bytes associated with a key value with read options.

Returns the bytes associated with a key value and the given column family with read options.

Return the values associated with the given keys.

Return the values associated with the given keys using read options.

Return the values associated with the given keys and column families.

Return the values associated with the given keys and column families using read options.

Opens an iterator using the provided ReadOptions. This is used when you want to iterate over a specific ColumnFamily with a modified ReadOptions

Opens an iterator with set_total_order_seek enabled. This must be used to iterate across prefixes when set_memtable_factory has been called with a Hash-based implementation.

Opens a raw iterator over the database, using the default read options

Opens a raw iterator over the given column family, using the default read options

Opens a raw iterator over the database, using the given read options

Opens a raw iterator over the given column family, using the given read options

Creates column family with given name and options.

Returns the underlying column family handle.

Creates column family with given name and options.

Returns the underlying column family handle.

Trait Implementations§

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.