mirror of https://github.com/facebook/rocksdb.git
Better interface to create BackupEngine
Summary: I think it looks nicer. In RocksDB we have both styles, but I think that static method is the more common version. Test Plan: backupable_db_test Reviewers: ljin, benj, swk Reviewed By: ljin CC: leveldb Differential Revision: https://reviews.facebook.net/D15519
This commit is contained in:
parent
ec2fa4a690
commit
e5ec7384a0
|
@ -85,6 +85,9 @@ class BackupEngine {
|
|||
public:
|
||||
virtual ~BackupEngine() {}
|
||||
|
||||
static BackupEngine* NewBackupEngine(Env* db_env,
|
||||
const BackupableDBOptions& options);
|
||||
|
||||
virtual Status CreateNewBackup(DB* db, bool flush_before_backup = false) = 0;
|
||||
virtual Status PurgeOldBackups(uint32_t num_backups_to_keep) = 0;
|
||||
virtual Status DeleteBackup(BackupID backup_id) = 0;
|
||||
|
@ -100,9 +103,6 @@ class BackupEngine {
|
|||
virtual void DeleteBackupsNewerThan(uint64_t sequence_number) = 0;
|
||||
};
|
||||
|
||||
extern BackupEngine* CreateNewBackupEngine(Env* db_env,
|
||||
const BackupableDBOptions& options);
|
||||
|
||||
// Stack your DB with BackupableDB to be able to backup the DB
|
||||
class BackupableDB : public StackableDB {
|
||||
public:
|
||||
|
|
|
@ -188,8 +188,8 @@ class BackupEngineImpl : public BackupEngine {
|
|||
static const size_t copy_file_buffer_size_ = 5 * 1024 * 1024LL; // 5MB
|
||||
};
|
||||
|
||||
BackupEngine* CreateNewBackupEngine(Env* db_env,
|
||||
const BackupableDBOptions& options) {
|
||||
BackupEngine* BackupEngine::NewBackupEngine(
|
||||
Env* db_env, const BackupableDBOptions& options) {
|
||||
return new BackupEngineImpl(db_env, options);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue