MCPcopy Create free account
hub / github.com/apple/foundationdb / renameFile

Method renameFile

fdbrpc/include/fdbrpc/AsyncFileEIO.actor.h:125–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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));

Callers

nothing calls this directly

Calls 10

eio_renameFunction · 0.85
eio_cancelFunction · 0.85
TraceEventClass · 0.85
delayFunction · 0.85
detailMethod · 0.80
VoidClass · 0.50
getCurrentTaskMethod · 0.45
c_strMethod · 0.45
getFutureMethod · 0.45
setCurrentTaskMethod · 0.45

Tested by

no test coverage detected