diff --git a/backup-daemon/databackupproxy.h b/backup-daemon/databackupproxy.h index 8550ce7..d73b3dc 100755 --- a/backup-daemon/databackupproxy.h +++ b/backup-daemon/databackupproxy.h @@ -58,7 +58,7 @@ private: protected: // 判断是否增量备份 - bool isIncBackup(); + virtual bool isIncBackup(); /** * @brief 根据场景获取rsync命令参数 diff --git a/backup-daemon/udiskdatabackupproxy.cpp b/backup-daemon/udiskdatabackupproxy.cpp index ce171c6..b552b65 100755 --- a/backup-daemon/udiskdatabackupproxy.cpp +++ b/backup-daemon/udiskdatabackupproxy.cpp @@ -122,6 +122,30 @@ void UDiskDataBackupProxy::deleteFailedData() parse.deleteItem(m_curUuid); } +/** + * @brief 判断是否增量备份 + * @return true,增量备份; false,全量备份 + */ +bool UDiskDataBackupProxy::isIncBackup() +{ + QString backupPath; + ParseBackupList::BackupPoint point; + if (m_backupWrapper.m_uuid.isEmpty()) { + return false; + } else { + backupPath = m_backupWrapper.m_prefixDestPath + BACKUP_SNAPSHOTS_PATH + "/" + m_backupWrapper.m_uuid + "/data"; + } + + backupPath.replace("//", "/"); + if (Utils::isDirExist(backupPath)) { + m_backupWrapper.m_bIncrement = true; + m_backupWrapper.m_type = BackupType::INC_BACKUP_DATA; + return true; + } + return false; +} + + /** * @brief 校验剩余空间是否满足备份 */ diff --git a/backup-daemon/udiskdatabackupproxy.h b/backup-daemon/udiskdatabackupproxy.h index 6721d55..213f401 100755 --- a/backup-daemon/udiskdatabackupproxy.h +++ b/backup-daemon/udiskdatabackupproxy.h @@ -42,6 +42,8 @@ private slots: protected: // 失败则删除相应数据 virtual void deleteFailedData(); + // 判断是否增量备份 + virtual bool isIncBackup(); private: // 计算备份所需空间大小