@@ -17,7 +17,7 @@ use std::{
1717} ;
1818
1919use rocksdb:: {
20- BlockBasedOptions , ColumnFamily , ColumnFamilyDescriptor , Options , ReadOptions , WriteBatch , WriteOptions , DB ,
20+ BlockBasedOptions , ColumnFamilyDescriptor , ColumnFamilyRef , Options , ReadOptions , WriteBatch , WriteOptions , DB
2121} ;
2222
2323use kvdb:: { DBKeyValue , DBOp , DBTransaction , DBValue , KeyValueDB } ;
@@ -251,7 +251,7 @@ struct DBAndColumns {
251251}
252252
253253impl DBAndColumns {
254- fn cf ( & self , i : usize ) -> io:: Result < & ColumnFamily > {
254+ fn cf ( & self , i : usize ) -> io:: Result < ColumnFamilyRef < ' _ > > {
255255 let name = self . column_names . get ( i) . ok_or_else ( || invalid_column ( i as u32 ) ) ?;
256256 self . db
257257 . cf_handle ( & name)
@@ -377,6 +377,7 @@ impl Database {
377377 Err ( _) => {
378378 // retry and create CFs
379379 match DB :: open_cf ( & opts, path. as_ref ( ) , & [ ] as & [ & str ] ) {
380+ #[ allow( unused_mut) ] // warns when `multi-threaded-cf` feature is enabled on rocksdb, as `create_cf` takes an &self.
380381 Ok ( mut db) => {
381382 for ( i, name) in column_names. iter ( ) . enumerate ( ) {
382383 let _ = db
@@ -436,23 +437,23 @@ impl Database {
436437 match op {
437438 DBOp :: Insert { col : _, key, value } => {
438439 stats_total_bytes += key. len ( ) + value. len ( ) ;
439- batch. put_cf ( cf, & key, & value) ;
440+ batch. put_cf ( & cf, & key, & value) ;
440441 } ,
441442 DBOp :: Delete { col : _, key } => {
442443 // We count deletes as writes.
443444 stats_total_bytes += key. len ( ) ;
444- batch. delete_cf ( cf, & key) ;
445+ batch. delete_cf ( & cf, & key) ;
445446 } ,
446447 DBOp :: DeletePrefix { col, prefix } => {
447448 let end_prefix = kvdb:: end_prefix ( & prefix[ ..] ) ;
448449 let no_end = end_prefix. is_none ( ) ;
449450 let end_range = end_prefix. unwrap_or_else ( || vec ! [ u8 :: max_value( ) ; 16 ] ) ;
450- batch. delete_range_cf ( cf, & prefix[ ..] , & end_range[ ..] ) ;
451+ batch. delete_range_cf ( & cf, & prefix[ ..] , & end_range[ ..] ) ;
451452 if no_end {
452453 let prefix = if prefix. len ( ) > end_range. len ( ) { & prefix[ ..] } else { & end_range[ ..] } ;
453454 for result in self . iter_with_prefix ( col, prefix) {
454455 let ( key, _) = result?;
455- batch. delete_cf ( cf, & key[ ..] ) ;
456+ batch. delete_cf ( & cf, & key[ ..] ) ;
456457 }
457458 }
458459 } ,
@@ -470,7 +471,7 @@ impl Database {
470471 self . stats . tally_reads ( 1 ) ;
471472 let value = cfs
472473 . db
473- . get_pinned_cf_opt ( cf, key, & self . read_opts )
474+ . get_pinned_cf_opt ( & cf, key, & self . read_opts )
474475 . map ( |r| r. map ( |v| v. to_vec ( ) ) )
475476 . map_err ( other_io_err) ;
476477
@@ -521,7 +522,7 @@ impl Database {
521522 const ESTIMATE_NUM_KEYS : & str = "rocksdb.estimate-num-keys" ;
522523 let cfs = & self . inner ;
523524 let cf = cfs. cf ( col as usize ) ?;
524- match cfs. db . property_int_value_cf ( cf, ESTIMATE_NUM_KEYS ) {
525+ match cfs. db . property_int_value_cf ( & cf, ESTIMATE_NUM_KEYS ) {
525526 Ok ( estimate) => Ok ( estimate. unwrap_or_default ( ) ) ,
526527 Err ( err_string) => Err ( other_io_err ( err_string) ) ,
527528 }
0 commit comments