Skip to content

Commit

Permalink
Make create_new_backup_flush generic (#677)
Browse files Browse the repository at this point in the history
Co-authored-by: Oleksandr Anyshchenko <[email protected]>
  • Loading branch information
minshao and Oleksandr Anyshchenko authored Sep 1, 2022
1 parent 080d2fa commit f4b1bd3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// 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 std::path::Path;
Expand Down Expand Up @@ -66,17 +66,20 @@ impl BackupEngine {
///
/// Note: no flush before backup is performed. User might want to
/// 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)
}

/// Captures the state of the database in the latest backup.
///
/// Set flush_before_backup=true to avoid losing unflushed key/value
/// pairs from the memtable.
pub fn create_new_backup_flush(
pub fn create_new_backup_flush<T: ThreadMode, D: DBInner>(
&mut self,
db: &DB,
db: &DBCommon<T, D>,
flush_before_backup: bool,
) -> Result<(), Error> {
unsafe {
Expand Down

0 comments on commit f4b1bd3

Please sign in to comment.