| 1 | // -------------------------------------------------------------------------- |
|---|
| 2 | // |
|---|
| 3 | // File |
|---|
| 4 | // Name: BoxBackupCompareParams.h |
|---|
| 5 | // Purpose: Parameters and notifiers for a compare operation |
|---|
| 6 | // Created: 2008/12/30 |
|---|
| 7 | // |
|---|
| 8 | // -------------------------------------------------------------------------- |
|---|
| 9 | |
|---|
| 10 | #ifndef BOXBACKUPCOMPAREPARAMS__H |
|---|
| 11 | #define BOXBACKUPCOMPAREPARAMS__H |
|---|
| 12 | |
|---|
| 13 | #include <memory> |
|---|
| 14 | #include <string> |
|---|
| 15 | |
|---|
| 16 | #include "BoxTime.h" |
|---|
| 17 | #include "ExcludeList.h" |
|---|
| 18 | #include "BackupClientMakeExcludeList.h" |
|---|
| 19 | |
|---|
| 20 | // -------------------------------------------------------------------------- |
|---|
| 21 | // |
|---|
| 22 | // Class |
|---|
| 23 | // Name: BoxBackupCompareParams |
|---|
| 24 | // Purpose: Parameters and notifiers for a compare operation |
|---|
| 25 | // Created: 2003/10/10 |
|---|
| 26 | // |
|---|
| 27 | // -------------------------------------------------------------------------- |
|---|
| 28 | class BoxBackupCompareParams |
|---|
| 29 | { |
|---|
| 30 | private: |
|---|
| 31 | std::auto_ptr<const ExcludeList> mapExcludeFiles, mapExcludeDirs; |
|---|
| 32 | bool mQuickCompare; |
|---|
| 33 | bool mIgnoreExcludes; |
|---|
| 34 | bool mIgnoreAttributes; |
|---|
| 35 | box_time_t mLatestFileUploadTime; |
|---|
| 36 | |
|---|
| 37 | public: |
|---|
| 38 | BoxBackupCompareParams(bool QuickCompare, bool IgnoreExcludes, |
|---|
| 39 | bool IgnoreAttributes, box_time_t LatestFileUploadTime) |
|---|
| 40 | : mQuickCompare(QuickCompare), |
|---|
| 41 | mIgnoreExcludes(IgnoreExcludes), |
|---|
| 42 | mIgnoreAttributes(IgnoreAttributes), |
|---|
| 43 | mLatestFileUploadTime(LatestFileUploadTime) |
|---|
| 44 | { } |
|---|
| 45 | |
|---|
| 46 | virtual ~BoxBackupCompareParams() { } |
|---|
| 47 | |
|---|
| 48 | bool QuickCompare() { return mQuickCompare; } |
|---|
| 49 | bool IgnoreExcludes() { return mIgnoreExcludes; } |
|---|
| 50 | bool IgnoreAttributes() { return mIgnoreAttributes; } |
|---|
| 51 | box_time_t LatestFileUploadTime() { return mLatestFileUploadTime; } |
|---|
| 52 | |
|---|
| 53 | void LoadExcludeLists(const Configuration& rLoc) |
|---|
| 54 | { |
|---|
| 55 | mapExcludeFiles.reset(BackupClientMakeExcludeList_Files(rLoc)); |
|---|
| 56 | mapExcludeDirs.reset(BackupClientMakeExcludeList_Dirs(rLoc)); |
|---|
| 57 | } |
|---|
| 58 | bool IsExcludedFile(const std::string& rLocalPath) |
|---|
| 59 | { |
|---|
| 60 | if (!mapExcludeFiles.get()) return false; |
|---|
| 61 | return mapExcludeFiles->IsExcluded(rLocalPath); |
|---|
| 62 | } |
|---|
| 63 | bool IsExcludedDir(const std::string& rLocalPath) |
|---|
| 64 | { |
|---|
| 65 | if (!mapExcludeDirs.get()) return false; |
|---|
| 66 | return mapExcludeDirs->IsExcluded(rLocalPath); |
|---|
| 67 | } |
|---|
| 68 | |
|---|
| 69 | virtual void NotifyLocalDirMissing(const std::string& rLocalPath, |
|---|
| 70 | const std::string& rRemotePath) = 0; |
|---|
| 71 | virtual void NotifyLocalDirAccessFailed(const std::string& rLocalPath, |
|---|
| 72 | const std::string& rRemotePath) = 0; |
|---|
| 73 | virtual void NotifyStoreDirMissingAttributes(const std::string& rLocalPath, |
|---|
| 74 | const std::string& rRemotePath) = 0; |
|---|
| 75 | virtual void NotifyRemoteFileMissing(const std::string& rLocalPath, |
|---|
| 76 | const std::string& rRemotePath, |
|---|
| 77 | bool modifiedAfterLastSync) = 0; |
|---|
| 78 | virtual void NotifyLocalFileMissing(const std::string& rLocalPath, |
|---|
| 79 | const std::string& rRemotePath) = 0; |
|---|
| 80 | virtual void NotifyExcludedFileNotDeleted(const std::string& rLocalPath, |
|---|
| 81 | const std::string& rRemotePath) = 0; |
|---|
| 82 | virtual void NotifyDownloadFailed(const std::string& rLocalPath, |
|---|
| 83 | const std::string& rRemotePath, int64_t NumBytes, |
|---|
| 84 | BoxException& rException) = 0; |
|---|
| 85 | virtual void NotifyLocalFileReadFailed(const std::string& rLocalPath, |
|---|
| 86 | const std::string& rRemotePath, int64_t NumBytes, |
|---|
| 87 | std::exception& rException) = 0; |
|---|
| 88 | virtual void NotifyLocalFileReadFailed(const std::string& rLocalPath, |
|---|
| 89 | const std::string& rRemotePath, int64_t NumBytes) = 0; |
|---|
| 90 | virtual void NotifyDownloadFailed(const std::string& rLocalPath, |
|---|
| 91 | const std::string& rRemotePath, int64_t NumBytes, |
|---|
| 92 | std::exception& rException) = 0; |
|---|
| 93 | virtual void NotifyDownloadFailed(const std::string& rLocalPath, |
|---|
| 94 | const std::string& rRemotePath, int64_t NumBytes) = 0; |
|---|
| 95 | virtual void NotifyExcludedFile(const std::string& rLocalPath, |
|---|
| 96 | const std::string& rRemotePath) = 0; |
|---|
| 97 | virtual void NotifyExcludedDir(const std::string& rLocalPath, |
|---|
| 98 | const std::string& rRemotePath) = 0; |
|---|
| 99 | virtual void NotifyDirComparing(const std::string& rLocalPath, |
|---|
| 100 | const std::string& rRemotePath) = 0; |
|---|
| 101 | virtual void NotifyDirCompared(const std::string& rLocalPath, |
|---|
| 102 | const std::string& rRemotePath, bool HasDifferentAttributes, |
|---|
| 103 | bool modifiedAfterLastSync) = 0; |
|---|
| 104 | virtual void NotifyFileComparing(const std::string& rLocalPath, |
|---|
| 105 | const std::string& rRemotePath) = 0; |
|---|
| 106 | virtual void NotifyFileCompared(const std::string& rLocalPath, |
|---|
| 107 | const std::string& rRemotePath, int64_t NumBytes, |
|---|
| 108 | bool HasDifferentAttributes, bool HasDifferentContents, |
|---|
| 109 | bool modifiedAfterLastSync, bool newAttributesApplied) = 0; |
|---|
| 110 | }; |
|---|
| 111 | |
|---|
| 112 | #endif // BOXBACKUPCOMPAREPARAMS__H |
|---|