Changeset 2181 for box/trunk/bin/bbackupd/BackupClientDeleteList.cpp
- Timestamp:
- 28/05/2008 16:24:05 (4 years ago)
- File:
-
- 1 edited
-
box/trunk/bin/bbackupd/BackupClientDeleteList.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/bin/bbackupd/BackupClientDeleteList.cpp
r217 r2181 43 43 } 44 44 45 // -------------------------------------------------------------------------- 46 // 47 // Function 48 // Name: BackupClientDeleteList::AddDirectoryDelete(int64_t) 45 BackupClientDeleteList::FileToDelete::FileToDelete(int64_t DirectoryID, 46 const BackupStoreFilename& rFilename, 47 const std::string& rLocalPath) 48 : mDirectoryID(DirectoryID), 49 mFilename(rFilename), 50 mLocalPath(rLocalPath) 51 { } 52 53 BackupClientDeleteList::DirToDelete::DirToDelete(int64_t ObjectID, 54 const std::string& rLocalPath) 55 : mObjectID(ObjectID), 56 mLocalPath(rLocalPath) 57 { } 58 59 // -------------------------------------------------------------------------- 60 // 61 // Function 62 // Name: BackupClientDeleteList::AddDirectoryDelete(int64_t, 63 // const BackupStoreFilename&) 49 64 // Purpose: Add a directory to the list of directories to be deleted. 50 65 // Created: 10/11/03 51 66 // 52 67 // -------------------------------------------------------------------------- 53 void BackupClientDeleteList::AddDirectoryDelete(int64_t ObjectID) 68 void BackupClientDeleteList::AddDirectoryDelete(int64_t ObjectID, 69 const std::string& rLocalPath) 54 70 { 55 71 // Only add the delete to the list if it's not in the "no delete" set 56 if(mDirectoryNoDeleteList.find(ObjectID) == mDirectoryNoDeleteList.end()) 72 if(mDirectoryNoDeleteList.find(ObjectID) == 73 mDirectoryNoDeleteList.end()) 57 74 { 58 75 // Not in the list, so should delete it 59 mDirectoryList.push_back(ObjectID); 60 } 61 } 62 63 64 // -------------------------------------------------------------------------- 65 // 66 // Function 67 // Name: BackupClientDeleteList::AddFileDelete(int64_t, BackupStoreFilenameClear &) 76 mDirectoryList.push_back(DirToDelete(ObjectID, rLocalPath)); 77 } 78 } 79 80 81 // -------------------------------------------------------------------------- 82 // 83 // Function 84 // Name: BackupClientDeleteList::AddFileDelete(int64_t, 85 // const BackupStoreFilename &) 68 86 // Purpose: 69 87 // Created: 10/11/03 70 88 // 71 89 // -------------------------------------------------------------------------- 72 void BackupClientDeleteList::AddFileDelete(int64_t DirectoryID, const BackupStoreFilename &rFilename) 90 void BackupClientDeleteList::AddFileDelete(int64_t DirectoryID, 91 const BackupStoreFilename &rFilename, const std::string& rLocalPath) 73 92 { 74 93 // Try to find it in the no delete list 75 std::vector<std::pair<int64_t, BackupStoreFilename> >::iterator delEntry(mFileNoDeleteList.begin()); 94 std::vector<std::pair<int64_t, BackupStoreFilename> >::iterator 95 delEntry(mFileNoDeleteList.begin()); 76 96 while(delEntry != mFileNoDeleteList.end()) 77 97 { 78 if((delEntry)->first == DirectoryID && (delEntry)->second == rFilename) 98 if((delEntry)->first == DirectoryID 99 && (delEntry)->second == rFilename) 79 100 { 80 101 // Found! … … 87 108 if(delEntry == mFileNoDeleteList.end()) 88 109 { 89 mFileList.push_back(std::pair<int64_t, BackupStoreFilename>(DirectoryID, rFilename)); 110 mFileList.push_back(FileToDelete(DirectoryID, rFilename, 111 rLocalPath)); 90 112 } 91 113 } … … 114 136 115 137 // Do the deletes 116 for(std::vector<int64_t>::iterator i(mDirectoryList.begin()); i != mDirectoryList.end(); ++i) 117 { 118 connection.QueryDeleteDirectory(*i); 138 for(std::vector<DirToDelete>::iterator i(mDirectoryList.begin()); 139 i != mDirectoryList.end(); ++i) 140 { 141 connection.QueryDeleteDirectory(i->mObjectID); 142 rContext.GetProgressNotifier().NotifyDirectoryDeleted( 143 i->mObjectID, i->mLocalPath); 119 144 } 120 145 … … 123 148 124 149 // Delete the files 125 for(std::vector<std::pair<int64_t, BackupStoreFilename> >::iterator i(mFileList.begin()); i != mFileList.end(); ++i) 126 { 127 connection.QueryDeleteFile(i->first, i->second); 150 for(std::vector<FileToDelete>::iterator i(mFileList.begin()); 151 i != mFileList.end(); ++i) 152 { 153 connection.QueryDeleteFile(i->mDirectoryID, i->mFilename); 154 rContext.GetProgressNotifier().NotifyFileDeleted( 155 i->mDirectoryID, i->mLocalPath); 128 156 } 129 157 } … … 141 169 { 142 170 // First of all, is it in the delete vector? 143 std::vector<int64_t>::iterator delEntry(std::find(mDirectoryList.begin(), mDirectoryList.end(), ObjectID)); 171 std::vector<DirToDelete>::iterator delEntry(mDirectoryList.begin()); 172 for(; delEntry != mDirectoryList.end(); delEntry++) 173 { 174 if(delEntry->mObjectID == ObjectID) 175 { 176 // Found! 177 break; 178 } 179 } 144 180 if(delEntry != mDirectoryList.end()) 145 181 { … … 149 185 else 150 186 { 151 // Haven't been asked to delete it yet, put it in the no delete list 187 // Haven't been asked to delete it yet, put it in the 188 // no delete list 152 189 mDirectoryNoDeleteList.insert(ObjectID); 153 190 } … … 163 200 // 164 201 // -------------------------------------------------------------------------- 165 void BackupClientDeleteList::StopFileDeletion(int64_t DirectoryID, const BackupStoreFilename &rFilename) 202 void BackupClientDeleteList::StopFileDeletion(int64_t DirectoryID, 203 const BackupStoreFilename &rFilename) 166 204 { 167 205 // Find this in the delete list 168 std::vector< std::pair<int64_t, BackupStoreFilename>>::iterator delEntry(mFileList.begin());206 std::vector<FileToDelete>::iterator delEntry(mFileList.begin()); 169 207 while(delEntry != mFileList.end()) 170 208 { 171 if((delEntry)->first == DirectoryID && (delEntry)->second == rFilename) 209 if(delEntry->mDirectoryID == DirectoryID 210 && delEntry->mFilename == rFilename) 172 211 { 173 212 // Found! … … 187 226 mFileNoDeleteList.push_back(std::pair<int64_t, BackupStoreFilename>(DirectoryID, rFilename)); 188 227 } 189 190 } 191 192 193 194 195 228 } 229
Note: See TracChangeset
for help on using the changeset viewer.
