Type Definition rocksdb::DB [−][src]
type DB = DBWithThreadMode<SingleThreaded>;
A type alias to DB instance type with the single-threaded column family creations/deletions
Compatibility and multi-threaded mode
Previously, DB
was defined as a direct struct. Now, it’s type-aliased for
compatibility. Use DBWithThreadMode<MultiThreaded>
for multi-threaded
column family alternations.
Limited performance implication for single-threaded mode
Even with SingleThreaded
, almost all of RocksDB operations is
multi-threaded unless the underlying RocksDB instance is
specifically configured otherwise. SingleThreaded
only forces
serialization of column family alternations by requring &mut self
of DB
instance due to its wrapper implementation details.
Multi-threaded mode
MultiThreaded
can be appropriate for the situation of multi-threaded
workload including multi-threaded column family alternations, costing the
RwLock overhead inside DB
.