version 1.66, 2008/12/16 18:57:07
|
version 1.66.8.2, 2013/06/03 22:36:27
|
|
|
// copied back to the index file. | // copied back to the index file. |
// | // |
| |
|
do |
|
{ |
if (!FileSystem::renameFileNoCase(path, rollbackPath)) | if (!FileSystem::renameFileNoCase(path, rollbackPath)) |
{ | { |
PEG_METHOD_EXIT(); |
break; |
return false; |
|
} | } |
| |
if (!FileSystem::copyFile(rollbackPath, path)) | if (!FileSystem::copyFile(rollbackPath, path)) |
{ | { |
|
break; |
|
} |
|
|
|
PEG_METHOD_EXIT(); |
|
return true; |
|
} |
|
while(0); |
|
|
// Try to restore the initial state | // Try to restore the initial state |
FileSystem::removeFileNoCase(path); |
undoBeginTransaction(path); |
FileSystem::renameFileNoCase(rollbackPath, path); |
|
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return false; | return false; |
} | } |
| |
|
void InstanceIndexFile::undoBeginTransaction(const String& path) |
|
{ |
|
PEG_METHOD_ENTER(TRC_REPOSITORY, |
|
"InstanceIndexFile::undoBeginTransaction()"); |
|
|
|
String rollbackPath = path; |
|
rollbackPath.append(".rollback"); |
|
|
|
// |
|
// Remove the original index file and |
|
// Rename the rollback file to the original file |
|
// If the rollback file is present, this function has no effect |
|
// |
|
if(FileSystem::existsNoCase(rollbackPath)) |
|
{ |
|
FileSystem::removeFileNoCase(path); |
|
FileSystem::renameFileNoCase(rollbackPath, path); |
|
} |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return true; |
|
} | } |
| |
Boolean InstanceIndexFile::rollbackTransaction(const String& path) | Boolean InstanceIndexFile::rollbackTransaction(const String& path) |