| 1 | // -------------------------------------------------------------------------- |
|---|
| 2 | // |
|---|
| 3 | // File |
|---|
| 4 | // Name: BackupDaemonInterface.h |
|---|
| 5 | // Purpose: Interfaces for managing a BackupDaemon |
|---|
| 6 | // Created: 2008/12/30 |
|---|
| 7 | // |
|---|
| 8 | // -------------------------------------------------------------------------- |
|---|
| 9 | |
|---|
| 10 | #ifndef BACKUPDAEMONINTERFACE__H |
|---|
| 11 | #define BACKUPDAEMONINTERFACE__H |
|---|
| 12 | |
|---|
| 13 | #include <string> |
|---|
| 14 | // #include <map> |
|---|
| 15 | |
|---|
| 16 | // #include "BackupClientFileAttributes.h" |
|---|
| 17 | // #include "BackupStoreDirectory.h" |
|---|
| 18 | #include "BoxTime.h" |
|---|
| 19 | // #include "MD5Digest.h" |
|---|
| 20 | // #include "ReadLoggingStream.h" |
|---|
| 21 | // #include "RunStatusProvider.h" |
|---|
| 22 | |
|---|
| 23 | class Archive; |
|---|
| 24 | class BackupClientContext; |
|---|
| 25 | class BackupDaemon; |
|---|
| 26 | |
|---|
| 27 | // -------------------------------------------------------------------------- |
|---|
| 28 | // |
|---|
| 29 | // Class |
|---|
| 30 | // Name: SysadminNotifier |
|---|
| 31 | // Purpose: Provides a NotifySysadmin() method to send mail to the sysadmin |
|---|
| 32 | // Created: 2005/11/15 |
|---|
| 33 | // |
|---|
| 34 | // -------------------------------------------------------------------------- |
|---|
| 35 | class SysadminNotifier |
|---|
| 36 | { |
|---|
| 37 | public: |
|---|
| 38 | virtual ~SysadminNotifier() { } |
|---|
| 39 | |
|---|
| 40 | typedef enum |
|---|
| 41 | { |
|---|
| 42 | StoreFull = 0, |
|---|
| 43 | ReadError, |
|---|
| 44 | BackupError, |
|---|
| 45 | BackupStart, |
|---|
| 46 | BackupFinish, |
|---|
| 47 | BackupOK, |
|---|
| 48 | MAX |
|---|
| 49 | // When adding notifications, remember to add |
|---|
| 50 | // strings to NotifySysadmin() |
|---|
| 51 | } |
|---|
| 52 | EventCode; |
|---|
| 53 | |
|---|
| 54 | virtual void NotifySysadmin(EventCode Event) = 0; |
|---|
| 55 | }; |
|---|
| 56 | |
|---|
| 57 | // -------------------------------------------------------------------------- |
|---|
| 58 | // |
|---|
| 59 | // Class |
|---|
| 60 | // Name: ProgressNotifier |
|---|
| 61 | // Purpose: Provides methods for the backup library to inform the user |
|---|
| 62 | // interface about its progress with the backup |
|---|
| 63 | // Created: 2005/11/20 |
|---|
| 64 | // |
|---|
| 65 | // -------------------------------------------------------------------------- |
|---|
| 66 | |
|---|
| 67 | class BackupClientContext; |
|---|
| 68 | class BackupClientDirectoryRecord; |
|---|
| 69 | |
|---|
| 70 | class ProgressNotifier |
|---|
| 71 | { |
|---|
| 72 | public: |
|---|
| 73 | virtual ~ProgressNotifier() { } |
|---|
| 74 | virtual void NotifyIDMapsSetup(BackupClientContext& rContext) = 0; |
|---|
| 75 | virtual void NotifyScanDirectory( |
|---|
| 76 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 77 | const std::string& rLocalPath) = 0; |
|---|
| 78 | virtual void NotifyDirStatFailed( |
|---|
| 79 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 80 | const std::string& rLocalPath, |
|---|
| 81 | const std::string& rErrorMsg) = 0; |
|---|
| 82 | virtual void NotifyFileStatFailed( |
|---|
| 83 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 84 | const std::string& rLocalPath, |
|---|
| 85 | const std::string& rErrorMsg) = 0; |
|---|
| 86 | virtual void NotifyDirListFailed( |
|---|
| 87 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 88 | const std::string& rLocalPath, |
|---|
| 89 | const std::string& rErrorMsg) = 0; |
|---|
| 90 | virtual void NotifyMountPointSkipped( |
|---|
| 91 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 92 | const std::string& rLocalPath) = 0; |
|---|
| 93 | virtual void NotifyFileExcluded( |
|---|
| 94 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 95 | const std::string& rLocalPath) = 0; |
|---|
| 96 | virtual void NotifyDirExcluded( |
|---|
| 97 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 98 | const std::string& rLocalPath) = 0; |
|---|
| 99 | virtual void NotifyUnsupportedFileType( |
|---|
| 100 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 101 | const std::string& rLocalPath) = 0; |
|---|
| 102 | virtual void NotifyFileReadFailed( |
|---|
| 103 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 104 | const std::string& rLocalPath, |
|---|
| 105 | const std::string& rErrorMsg) = 0; |
|---|
| 106 | virtual void NotifyFileModifiedInFuture( |
|---|
| 107 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 108 | const std::string& rLocalPath) = 0; |
|---|
| 109 | virtual void NotifyFileSkippedServerFull( |
|---|
| 110 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 111 | const std::string& rLocalPath) = 0; |
|---|
| 112 | virtual void NotifyFileUploadException( |
|---|
| 113 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 114 | const std::string& rLocalPath, |
|---|
| 115 | const BoxException& rException) = 0; |
|---|
| 116 | virtual void NotifyFileUploadServerError( |
|---|
| 117 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 118 | const std::string& rLocalPath, |
|---|
| 119 | int type, int subtype) = 0; |
|---|
| 120 | virtual void NotifyFileUploading( |
|---|
| 121 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 122 | const std::string& rLocalPath) = 0; |
|---|
| 123 | virtual void NotifyFileUploadingPatch( |
|---|
| 124 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 125 | const std::string& rLocalPath) = 0; |
|---|
| 126 | virtual void NotifyFileUploadingAttributes( |
|---|
| 127 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 128 | const std::string& rLocalPath) = 0; |
|---|
| 129 | virtual void NotifyFileUploaded( |
|---|
| 130 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 131 | const std::string& rLocalPath, |
|---|
| 132 | int64_t FileSize, int64_t UploadedSize) = 0; |
|---|
| 133 | virtual void NotifyFileSynchronised( |
|---|
| 134 | const BackupClientDirectoryRecord* pDirRecord, |
|---|
| 135 | const std::string& rLocalPath, |
|---|
| 136 | int64_t FileSize) = 0; |
|---|
| 137 | virtual void NotifyDirectoryCreated( |
|---|
| 138 | int64_t ObjectID, |
|---|
| 139 | const std::string& rLocalPath, |
|---|
| 140 | const std::string& rRemotePath) = 0; |
|---|
| 141 | virtual void NotifyDirectoryDeleted( |
|---|
| 142 | int64_t ObjectID, |
|---|
| 143 | const std::string& rRemotePath) = 0; |
|---|
| 144 | virtual void NotifyFileDeleted( |
|---|
| 145 | int64_t ObjectID, |
|---|
| 146 | const std::string& rRemotePath) = 0; |
|---|
| 147 | virtual void NotifyReadProgress(int64_t readSize, int64_t offset, |
|---|
| 148 | int64_t length, box_time_t elapsed, box_time_t finish) = 0; |
|---|
| 149 | virtual void NotifyReadProgress(int64_t readSize, int64_t offset, |
|---|
| 150 | int64_t length) = 0; |
|---|
| 151 | virtual void NotifyReadProgress(int64_t readSize, int64_t offset) = 0; |
|---|
| 152 | }; |
|---|
| 153 | |
|---|
| 154 | // -------------------------------------------------------------------------- |
|---|
| 155 | // |
|---|
| 156 | // Class |
|---|
| 157 | // Name: LocationResolver |
|---|
| 158 | // Purpose: Interface for classes that can resolve locations to paths, |
|---|
| 159 | // like BackupDaemon |
|---|
| 160 | // Created: 2003/10/08 |
|---|
| 161 | // |
|---|
| 162 | // -------------------------------------------------------------------------- |
|---|
| 163 | class LocationResolver |
|---|
| 164 | { |
|---|
| 165 | public: |
|---|
| 166 | virtual ~LocationResolver() { } |
|---|
| 167 | virtual bool FindLocationPathName(const std::string &rLocationName, |
|---|
| 168 | std::string &rPathOut) const = 0; |
|---|
| 169 | }; |
|---|
| 170 | |
|---|
| 171 | #endif // BACKUPDAEMONINTERFACE__H |
|---|