2021-08-06 10:20:03 +08:00
|
|
|
|
#ifndef SYSTEMBACKUPPROXY_H
|
|
|
|
|
#define SYSTEMBACKUPPROXY_H
|
|
|
|
|
|
|
|
|
|
#include "workerfactory.h"
|
|
|
|
|
|
|
|
|
|
class SystemBackupProxy : public Worker
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
DECLARE_DYNCREATE(SystemBackupProxy)
|
|
|
|
|
public:
|
2021-08-17 10:07:35 +08:00
|
|
|
|
// 系统备份的几种场景
|
|
|
|
|
enum SystemBackupScene {
|
|
|
|
|
SYSTEM_BACKUP, // 系统备份
|
|
|
|
|
INC_SYSTEM_BACKUP, // 增量系统备份
|
|
|
|
|
TRY_SYSTEM_BACKUP, // 测试系统备份,可用于计算备份传输数据大小
|
|
|
|
|
TRY_INC_SYSTEM_BACKUP, // 测试增量系统备份,可用于计算备份传输数据大小
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
explicit SystemBackupProxy();
|
2021-08-06 10:20:03 +08:00
|
|
|
|
virtual ~SystemBackupProxy();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
// 环境检测
|
|
|
|
|
virtual void checkEnvEx();
|
|
|
|
|
|
|
|
|
|
// 任务处理
|
|
|
|
|
virtual void doWorkEx();
|
|
|
|
|
|
|
|
|
|
// 任务取消
|
|
|
|
|
virtual void cancelEx();
|
2021-08-17 10:07:35 +08:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
// 校验是否增量备份
|
|
|
|
|
bool checkIsIncBackup();
|
|
|
|
|
|
|
|
|
|
// 校验剩余空间是否满足备份
|
|
|
|
|
void checkFreeCapacity(bool bInc);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 根据场景获取rsync命令参数
|
|
|
|
|
* @param scene,场景
|
|
|
|
|
* @return 组装好的rsync的参数信息
|
|
|
|
|
*/
|
|
|
|
|
QString getRsyncArgs(SystemBackupScene scene);
|
|
|
|
|
|
|
|
|
|
// 是否增量备份
|
|
|
|
|
bool m_bIncrement = false;
|
2021-08-06 10:20:03 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // SYSTEMBACKUPPROXY_H
|