| 123 | } |
| 124 | |
| 125 | ACTOR static Future<Void> renameFile(std::string from, std::string to) { |
| 126 | state TaskPriority taskID = g_network->getCurrentTask(); |
| 127 | state Promise<Void> p; |
| 128 | state eio_req* r = eio_rename(from.c_str(), to.c_str(), 0, eio_callback, &p); |
| 129 | try { |
| 130 | wait(p.getFuture()); |
| 131 | } catch (...) { |
| 132 | g_network->setCurrentTask(taskID); |
| 133 | eio_cancel(r); |
| 134 | throw; |
| 135 | } |
| 136 | try { |
| 137 | state int result = r->result; |
| 138 | if (result == -1) { |
| 139 | TraceEvent(SevError, "FileRenameError").detail("Errno", r->errorno); |
| 140 | throw internal_error(); |
| 141 | } else { |
| 142 | wait(delay(0, taskID)); |
| 143 | return Void(); |
| 144 | } |
| 145 | } catch (Error& e) { |
| 146 | state Error _e = e; |
| 147 | wait(delay(0, taskID)); |
| 148 | throw _e; |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | ACTOR static Future<std::time_t> lastWriteTime(std::string filename) { |
| 153 | EIO_STRUCT_STAT statdata = wait(stat_impl(filename)); |
nothing calls this directly
no test coverage detected