Type Definition speedb::DB

source ·
pub type DB = DBWithThreadMode<SingleThreaded>;
Expand description

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 DBCommon<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 requiring &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.