Renames tmp file to final destination Returns true if commit succeeded
| 351 | // Renames tmp file to final destination |
| 352 | // Returns true if commit succeeded |
| 353 | bool PutFile::ReadCallback::commit() { |
| 354 | bool success = false; |
| 355 | |
| 356 | logger_->log_info("PutFile committing put file operation to %s", dest_file_); |
| 357 | |
| 358 | if (write_succeeded_) { |
| 359 | if (rename(tmp_file_.c_str(), dest_file_.c_str())) { |
| 360 | logger_->log_info("PutFile commit put file operation to %s failed because rename() call failed", dest_file_); |
| 361 | } else { |
| 362 | success = true; |
| 363 | logger_->log_info("PutFile commit put file operation to %s succeeded", dest_file_); |
| 364 | } |
| 365 | } else { |
| 366 | logger_->log_error("PutFile commit put file operation to %s failed because write failed", dest_file_); |
| 367 | } |
| 368 | |
| 369 | return success; |
| 370 | } |
| 371 | |
| 372 | // Clean up resources |
| 373 | PutFile::ReadCallback::~ReadCallback() { |
no test coverage detected