pub type OptimisticTransactionDB<T = SingleThreaded> = DBCommon<T, OptimisticTransactionDBInner>;
Expand description

A type alias to RocksDB Optimistic Transaction DB.

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

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

See DBCommon for full list of methods.

Examples

use rocksdb::{DB, Options, OptimisticTransactionDB, SingleThreaded};
let path = "_path_for_optimistic_transaction_db";
{
    let db: OptimisticTransactionDB = OptimisticTransactionDB::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

Methods of OptimisticTransactionDB.

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 default options.