Make `create_new_backup_flush` generic (#677)

Co-authored-by: Oleksandr Anyshchenko <oleksandr.anyshchenko@xdev.re>
master
minshao 2 years ago committed by GitHub
parent 080d2fa7c8
commit f4b1bd3570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/backup.rs

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
// //
use crate::{db::DBInner, ffi, ffi_util::to_cpath, Error, DB}; use crate::{db::DBInner, ffi, ffi_util::to_cpath, DBCommon, Error, ThreadMode};
use libc::{c_int, c_uchar}; use libc::{c_int, c_uchar};
use std::path::Path; use std::path::Path;
@ -66,7 +66,10 @@ impl BackupEngine {
/// ///
/// Note: no flush before backup is performed. User might want to /// Note: no flush before backup is performed. User might want to
/// use `create_new_backup_flush` instead. /// use `create_new_backup_flush` instead.
pub fn create_new_backup(&mut self, db: &DB) -> Result<(), Error> { pub fn create_new_backup<T: ThreadMode, D: DBInner>(
&mut self,
db: &DBCommon<T, D>,
) -> Result<(), Error> {
self.create_new_backup_flush(db, false) self.create_new_backup_flush(db, false)
} }
@ -74,9 +77,9 @@ impl BackupEngine {
/// ///
/// Set flush_before_backup=true to avoid losing unflushed key/value /// Set flush_before_backup=true to avoid losing unflushed key/value
/// pairs from the memtable. /// pairs from the memtable.
pub fn create_new_backup_flush( pub fn create_new_backup_flush<T: ThreadMode, D: DBInner>(
&mut self, &mut self,
db: &DB, db: &DBCommon<T, D>,
flush_before_backup: bool, flush_before_backup: bool,
) -> Result<(), Error> { ) -> Result<(), Error> {
unsafe { unsafe {

Loading…
Cancel
Save