| 288 | } |
| 289 | |
| 290 | void DiskObjectStorage::copyFile( /// NOLINT |
| 291 | const String & from_file_path, |
| 292 | IDisk & to_disk, |
| 293 | const String & to_file_path, |
| 294 | const ReadSettings & read_settings, |
| 295 | const WriteSettings & write_settings, |
| 296 | const std::function<void()> & cancellation_hook) |
| 297 | { |
| 298 | auto component_guard = Coordination::setCurrentComponent("DiskObjectStorage::copyFile"); |
| 299 | if (getDataSourceDescription() == to_disk.getDataSourceDescription()) |
| 300 | { |
| 301 | /// It may use s3-server-side copy |
| 302 | auto & to_disk_object_storage = dynamic_cast<DiskObjectStorage &>(to_disk); |
| 303 | auto transaction = createObjectStorageTransactionToAnotherDisk(to_disk_object_storage); |
| 304 | try |
| 305 | { |
| 306 | transaction->copyFile(from_file_path, to_file_path, read_settings, write_settings); |
| 307 | transaction->commit(); |
| 308 | } |
| 309 | catch (...) |
| 310 | { |
| 311 | // Roll back any destination blobs that were copied in case copyFile() |
| 312 | // threw an exception and commit() was not reached. |
| 313 | transaction->undo(); |
| 314 | throw; |
| 315 | } |
| 316 | } |
| 317 | else |
| 318 | { |
| 319 | /// Copy through buffers |
| 320 | IDisk::copyFile(from_file_path, to_disk, to_file_path, read_settings, write_settings, cancellation_hook); |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | void DiskObjectStorage::replaceFile(const String & from_path, const String & to_path) |
| 325 | { |
nothing calls this directly
no test coverage detected