From a45e7a27c0211660911322fe648b954a05201429 Mon Sep 17 00:00:00 2001 From: zhaominyong Date: Thu, 30 Jun 2022 16:37:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E6=B5=8B=E5=8F=91=E7=8E=B0U=E7=9B=98?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A2=9E=E9=87=8F=E5=A4=87=E4=BB=BD=E6=9C=89?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backup-daemon/databackupproxy.h | 2 +- backup-daemon/udiskdatabackupproxy.cpp | 24 ++++++++++++++++++++++++ backup-daemon/udiskdatabackupproxy.h | 2 ++ 3 files changed, 27 insertions(+), 1 deletion(-) 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: // 计算备份所需空间大小