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

Method read_impl

fdbrpc/include/fdbrpc/AsyncFileEIO.actor.h:332–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330 }
331
332 ACTOR static Future<int> read_impl(int fd, void* data, int length, int64_t offset) {
333 state TaskPriority taskID = g_network->getCurrentTask();
334 state Promise<Void> p;
335 // fprintf(stderr, "eio_read (fd=%d length=%d offset=%lld)\n", fd, length, offset);
336 state eio_req* r = eio_read(fd, data, length, offset, 0, eio_callback, &p);
337 try {
338 wait(p.getFuture());
339 } catch (...) {
340 g_network->setCurrentTask(taskID);
341 eio_cancel(r);
342 throw;
343 }
344 try {
345 state int result = r->result;
346 // printf("eio read: %d/%d\n", r->result, length);
347 if (result == -1) {
348 error("ReadError", fd, r);
349 throw internal_error();
350 } else {
351 wait(delay(0, taskID));
352 return result;
353 }
354 } catch (Error& _e) {
355 state Error e = _e;
356 wait(delay(0, taskID));
357 throw e;
358 }
359 }
360
361 ACTOR static Future<Void> write_impl(int fd, Reference<ErrorInfo> err, StringRef data, int64_t offset) {
362 state TaskPriority taskID = g_network->getCurrentTask();

Callers

nothing calls this directly

Calls 7

eio_readFunction · 0.85
eio_cancelFunction · 0.85
delayFunction · 0.85
errorFunction · 0.50
getCurrentTaskMethod · 0.45
getFutureMethod · 0.45
setCurrentTaskMethod · 0.45

Tested by

no test coverage detected